wood burning stoves 2.0*
The moose likes Servlets and the fly likes Communication between two web applications running on different tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Communication between two web applications running on different tomcat" Watch "Communication between two web applications running on different tomcat" New topic
Author

Communication between two web applications running on different tomcat

anirban sarkar
Greenhorn

Joined: Dec 04, 2008
Posts: 7
Hi,

I've two j2ee web applications running on two different tomcat instance.How do I communicate between them.I want to pass a map from one to another.I wont use shared db table for both the application.

Can you please tell some other ways for this.


Thanks
Anirban
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
You can use a Servlet or web services.


My Blog
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
Web services with Axis2 however pose a limitation of passing the user defined objects (or some predefined apis - ResultSet for example) through. The starting up solution is to pile everything on the HashMap and retrieve the required information. If not, Axis2 provides for serialization of your class to flatten it to pass through and get accepted.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
It is not just with Axis, all kind of web services have limitations. They work well with primitives (including String), arrays of primitives, objects which contain primitives and/or their arrays and arrays of such objects. For everything else there is no straightforward way and they are not portable as well.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
For situations where you have control over both sides of the wire, and where no other clients need to be supported, I wouldn't recommend web services. Their overhead is real, and it wouldn't really pay off in this situation.

If the JVM version is the same on both sides, you could serialize the object over an HTTP connection. Or omit HTTP altogether, and serialize them over a Socket connection.

Or, more cross-platform and cross-version compatible, use an HTTP POST where the parameters are the keys and values of the Map as strings. That wouldn't work so well if the objects are structured, though (as opposed to being more or less primitives than can easily be converted to/from strings).


Ping & DNS - my free Android networking tools app
Nitin Pathak
Ranch Hand

Joined: Sep 25, 2006
Posts: 70
I gave a look to Google App Engine's URLFetch API, which can be used for the web service invocation and HTTP POST or HTTPS POST for that matter. Is there any pre-existing APIs available coded specifically for (read 'in') Java?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Communication between two web applications running on different tomcat