Timeout problem
I am writing an application that uses web services to connect to a remote server. I wrote a method for the ping function to determine if the server is online or not (that is, it provides web services that can be accessed using host: port). I am running a simple web service with a 2 second timeout (available as an option in the stub class before I make the call). Initially, the call should return within 2 seconds, allowing me to figure out if the server is up or down. However, in some cases, this takes much longer than 2 seconds.
Can anyone help me figure out why this is happening? Is there a way to ensure that the timeout value is met?
Thanks, Fell
Don't use the default sender, go to an http client based mail sender. The details are here - http://wiki.apache.org/ws/FrontPage/Axis/AxisCommonsHTTP - the same page has information on how to set different kinds of timeouts.
Axis client windows have an option to set a timeout. You can also use it. Note that timeout is measured in milliseconds. check here
And if it's Axis2, you can use it like this:
Stub s = new Stub();
ServiceClient sc = s.getServiceClient();
Options o = sc.getOptions();
o.setTimeOutInMilliSeconds(2000); //2 seconds
sc.setOptions(o);
s.setServiceClient(sc);
You can make your calls after installing the above material.