GeeCON Prague 2014*
The moose likes Java in General and the fly likes Framework to access Services from a Server... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Framework to access Services from a Server..." Watch "Framework to access Services from a Server..." New topic
Author

Framework to access Services from a Server...

Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Currently, the services will use Servlets. (through this Framework)..but, later, the Servlets would be replaced by web services. But, the Swing Client will use the Framework so that we do not need to change many classes. Framework will protect the client. Can someone suggest me such a framework?


Ananth Chellathurai [Walk on software]
Ajay Singh
Ranch Hand

Joined: Dec 13, 2006
Posts: 182
What is the business problem you are solving here?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
What does the servlet return now - XML? Then you could argue that it is a service already. If not then you may want to standardize now on an URL scheme that you can use unchanged later when you switch to REST-style services, and on a response format you can use now and later (most likely XML or JSON).


Ping & DNS - my free Android networking tools app
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

My servlets, return serialised objects. I am eager to know more on REST, can you provide my some good links on it.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
The http://faq.javaranch.com/java/WebServicesFaq has an extensive section with good links regarding REST.

Serialized objects are a Java-only technology, which goes against the spirit of web services. If your objects are JavaBeans you could use java.beans.XMLEncoder/Decoder for serialization. That would give you a shot at cross-platform compatibility and might still be usable in a more WS-style architecture.
Ananth Chellathurai
Ranch Hand

Joined: Nov 21, 2007
Posts: 349

Oh Great tip. So I should plan my servlets not to use serialised objects, and use JavaBeans instead?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42061
    
  64
The benefit is that if your objects can be represented as JavaBeans, then you get the (de)serialization for free. I'm not sure how well that works with more complicated objects (like nested arrays and collections), but it's easy to try and see what those classes create from those.
 
GeeCON Prague 2014
 
subject: Framework to access Services from a Server...