I'm using an Axis 1.4 webservice like this:
FooServiceLocator fooLocator = new FooServiceLocator();
fooLocator.getEngine().setOption("sendMultiRefs", false);
Foo foo = fooLocator.getFooService(new URL(soapServiceUrl));
How can I set a timeout for the connection establishment and for the opened connection?
(Similar to org.apache.commons.net.SocketClient
setTimeout()
and setSoTimeout()
)?
I found a hint that suggested setting a timeout like this:
((Stub) sPcspService).setTimeout(soapTimeoutSecs * 1000);
but the explicit cast looks more like a hack than on official API usage.
Grepping the source code I found references to
DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY
but neither do I know if I use the Commons HTTP Client
or another, nor how to apply this option.
I used to use axis 1.4 and soap as well, to set timeout for stub with your example, I would do as:
FooServiceLocator fooLocator = new FooServiceLocator();
fooLocator.getEngine().setOption("sendMultiRefs", false);
Foo foo = fooLocator.getFooService(new URL(soapServiceUrl));
FooStub binding = (FooStub) foo;
binding.setTimeout(soapTimeoutSecs * 1000);
Your FooStub is extended to org.apache.axis.client.Stub and if you generated the classes via wsdl2java you would got them already.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With