File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Communication between two web applications running on different tomcat

 
anirban sarkar
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use a Servlet or web services.
 
Nitin Pathak
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Nitin Pathak
Ranch Hand
Posts: 70
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic