• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Remoting - Communication between swing client and servlet

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,
I have architecture problem, I greatly appreciate your time if you have some time on this problem.

I am developing service layer for my project.

I have to communicate with swing client and web ( that deployed in different container)
We have remoting mechanism in place ( written using apache http client )
New Service layer that I am trying to develope is going to reside in another different container.

All the applications will be with in same firewall and they will not going to outside firewall

Also I have existing DAO layer and it give a set of DTO objects

With the above things in mind

I am planning to have my own set of DTO's to pass to clients. Here is what I want to do

1. Swing/Web client calls Remoting layer using DTO's given by service layer
2. Remoting Layer translates every thing in to XML ( we are using xstream ?? is it bad? what are the alternatives?)
3. Service Layer unmarshalls the XML in to DTO's back ( Do I need introduce Domain Objects ?? ,
Current services do not have domain objects concept )
4. Takes the clients request and communicates with DAO Layer
5. Fills the results in to DTO's back

Is the above architecure good ? I am afraid not because I feel I do not have concept of Domain objects
Also I have 2 different set of DTO's ( one from DAO layer and one from Service Layer)
Also Service Layer is trying to give DTO's back to client ? We do not want xml over head because everything in one firewall
am I doing it right? Where can I improve this architecure?


Thanks for your time, I really appreciate your help







 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using Spring? There are many remoting options in Spring Framework for this. You can use the HttpInvoker since both sides are Java.

Mark
 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can just use XML to communicate.

I don't know why you want to use DTO. DTO is for remote interfaces, this is no remote interface, a Swing client calls a servlet, it's only URL calling.

I also don't understand how using firewall is an issue for using XML. If you don't want big data size, you can use JSON, or send binary data.
 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Are you using Spring? There are many remoting options in Spring Framework for this. You can use the HttpInvoker since both sides are Java.



Mark, Thanks for the suggestion. I have plans to rewrite this remoting layer using Spring's http invoker.
But The question here is whether service layer need to maintain its own DTOs and pass it client or
do we need to use DTO's that is given by DAO layer ( these complicated and composite FAT DTO's , we cannot change this )
do you think Jason is best alternative too.? or using spring http invoker solves this problem too?

You can just use XML to communicate.



Kengkaj, Yes I am afraid of over head and big data sizes. Also we may not stick to one schema because our domain is too big
and different clients has different needs.
I will look in to Jason more.

Thank you for your time.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It depends on what you want to send over. With HttpInvoker, it ends up just looking like you are calling a method on a class and getting an return Java class back. Just like the classes were local to each other. That is the easiest, over XML or JSON.

Personally, it would be best to send the Domain objects returned from the DAO, because if you create DTO (anti-pattern) then you have to write and maintain all that error-prone adapter code to convert too and from your domain objects to your DTOs.

Mark
 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Mark !, Great and Helpful Advise!



 
reply
    Bookmark Topic Watch Topic
  • New Topic