Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remoting - Communication between swing client and servlet

 
vibeeshan kambli
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • 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







 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • 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
  • 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
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thank you Mark !, Great and Helpful Advise!



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic