java - How can I auto select a webservice? -


my application needs connect web service xml data. have primary , secondary web service.

what best way failover secondary web service if primary fails respond? how set timeout waiting primary?

thanks

the best solution set vip web service, , have failover automatically. way application cares 1 endpoint , doesn't need worry details.

if want handle java code, depends on libraries using connect web service. if using core java, might this:

try {    url primaryurl = new url(web_service_endpoint);   httpurlconnection con = (httpurlconnection) primaryurl.openconnection();   con.setconnecttimeout(5000); //set timeout 5 seconds    //try retrieving xml  } catch (java.net.sockettimeoutexception e) {   //try connecting secondary web service   //maybe recursive method call different url or } 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -