File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Web Service Multiple Endpoints Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service Multiple Endpoints" Watch "Web Service Multiple Endpoints" New topic
Author

Web Service Multiple Endpoints

Fernando Nos
Greenhorn

Joined: Jun 04, 2010
Posts: 3
Hi,

I use a java application to make a web service call. After some changes was decided that this same application should be able to decide, having multiple endpoints, which endpoint to call. These endpoints point to instances of the same web service. I used AXIS when I developed it. Could anyone helping me on changing it? How can I modify the application so it can decide what endpoint to use, to check if an endpoint is not responding.

Thanks
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Hi. I am trying to understand this. So please help me. This is my understanding of an endpoint:

- Say you have an ordering service at this endpoint http://yourcompany.com/services/OrderingService.
- And it provides three operations: placeOrder, cancelOrder and viewOrder.

Relative to the above endpoint, can you take an example of another endpoint where you might need to decide between the two? If you referring to different versions of the service, then this might help: http://www.ibm.com/developerworks/webservices/library/ws-version/
Fernando Nos
Greenhorn

Joined: Jun 04, 2010
Posts: 3
Ok. So now let`s say that this service is deployed in more than one machine, using managed servers. And now I want to make my java application to, before calling, check if the service is available in the endpoint. If it`s not, then it should try the next one.

http://yourcompany.com/services/OrderingService.

MyCompanyServer 1 - OrderingService - http://yourcompany.com/services/server1/OrderingService
MyCompanyServer 2 - OrderingService - http://yourcompany.com/services/server2/OrderingService

Is it clearer now?
R Srini
Ranch Hand

Joined: Feb 19, 2010
Posts: 215
Ok, that gives a better idea. If you are referring to clustering in a group of servers to provide higher availability than with a single server, then you could look into the documentation of your server because this is specific to the provider. Here are a few links for GlassFish and Axis:

GlassFish v2: http://developers.sun.com/appserver/reference/techart/glassfishcluster/
GlassFish v3 (not sure if v3 supports clustering yet): http://wiki.glassfish.java.net/Wiki.jsp?page=GlassFishV3Clustering
Axis2/Tomcat: http://www.swview.org/node/182
Tomcat: http://tomcat.apache.org/tomcat-5.5-doc/cluster-howto.html

Or if clustering is not an option, then you can still have multiple ports (which are the same as endpoints) in a single wsdl. To be clear, I haven't tried this myself making it up as I go along but you can have multiple endpoints a.k.a. ports in a WSDL, each specifying a different address, but using the same binding:

And of course, servers usually have a method in there to check whether they are running. For example, Axis has an isRunning() method.

So maybe this is what you are looking for. In this case, if a wsdl generator does not generate multiple ports for the same address, then you might have to manually modify the wsdl and then use a static wsdl. LOL. If you try this out, please let me know if it works.

All said, with what you are trying to achieve, clustering is probably a better fit as it directly addresses your problem without any additional code on your part. Of course, there will be the clustering configuration work.
 
Consider Paul's rocket mass heater.
 
subject: Web Service Multiple Endpoints