Q: How do I set a timeout when using { { { WSDL2Java } } } stubs?
A: There is a setTimeout method on the org.apache.axis.client.Stub class, which is the class all emitted stubs extend.
Here is how to set the timeout given a service named Foo:
{{{ { { { FooServiceLocator loc = new FooServiceLocator(); } } }
{ { { FooService binding = loc.getFooService(); } } } org.apache.axis.client.Stub s = (Stub) binding; s.setTimeout(1000); // 1 second, in miliseconds }}}
The default timeout in Axis 1.1 and later is 60 seconds. Axis 1.0 did not have a default timeout (i.e. it defaulted to 0). This timeout value is set on the HTTP socket and is not a connection timeout, which requires implementation we do not have as of Axis 1.1.