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));
我该如何为连接建立和已打开的连接设置超时时间?(类似于org.apache.commons.net.SocketClient
的setTimeout()
和setSoTimeout()
)?
我找到了一个提示,建议按照以下方式设置超时时间:
((Stub) sPcspService).setTimeout(soapTimeoutSecs * 1000);
但是显式转换看起来更像是一种黑客行为,而不是官方API使用方式。
在源代码中搜索,我发现了对DefaultCommonsHTTPClientProperties.CONNECTION_DEFAULT_SO_TIMEOUT_KEY的引用,但我不知道我是否使用了Commons HTTP Client,也不知道如何应用此选项。