This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service Multiple Endpoints" Watch "Web Service Multiple Endpoints" New topic

Web Service Multiple Endpoints

Fernando Nos

Joined: Jun 04, 2010
Posts: 3

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.

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
- 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:
Fernando Nos

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.

MyCompanyServer 1 - OrderingService -
MyCompanyServer 2 - 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:
GlassFish v3 (not sure if v3 supports clustering yet):

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.
It is sorta covered in the JavaRanch Style Guide.
subject: Web Service Multiple Endpoints
Similar Threads
Handlers and Providers Interfaces
Multiple Web Service Endpoints sharing one Java Process
update strategy with new WSDL question.