2

I am looking for a Java library that could help me invoke a webservice method and that can handle multiple webservers in case some of them are not responding. The idea is to enable failover when a cluster of servers provide the same webservice.

Some kind of scenario:

  • client invokes method A on server 1
  • server 1 is down
  • automatically try server 2
  • ...

Is there any such library available?

  • Are you asking about the client-side only, an app developer trying to access various web service servers? Or do you mean server-side failover handling to be employed by a sysadmin? Your Question seems to mention both. – Basil Bourque Jun 26 '15 at 21:27
  • My question is regarding the client side only. Forgot to mention that it's using a jax-ws client. – Guillaume Polet Jun 29 '15 at 10:21
  • You should edit your Question with additional info rather than post as comments. Use that "edit" link below your question (if using a web browser rather than app). – Basil Bourque Jun 29 '15 at 17:39
1

HTTP Client Libraries

Usually we do that kind of successive-URL-call work directly in our own code, using HTTP client libraries to assist.

HTTP client libraries such as Apache HttpComponents Google HTTP Client Library, and jsoup allow you to set a timeout, and they throw exceptions when various problems arise such as a 404.

So you write a series of cascading if statements trying each target URL in series until one succeeds. Setting those URLs, timeouts, and exception handling takes about the same code as would configuring some kind of library.

  • I forgot to mention that myclient is a jax-ws client and hence would prefr not tohave to reimplement this logic indiffrent places – Guillaume Polet Jun 29 '15 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.