Java 为Axis SOAP Web服务设置超时

Java 为Axis SOAP Web服务设置超时,java,soap,timeout,axis,Java,Soap,Timeout,Axis,我使用的Axis 1.4 Web服务如下: FooServiceLocator fooLocator = new FooServiceLocator(); fooLocator.getEngine().setOption("sendMultiRefs", false); Foo foo = fooLocator.getFooService(new URL(soapServiceUrl)); ((Stub) sPcspService).setTimeout(soapTimeoutSecs * 1

我使用的Axis 1.4 Web服务如下:

FooServiceLocator fooLocator = new FooServiceLocator();
fooLocator.getEngine().setOption("sendMultiRefs", false);
Foo foo = fooLocator.getFooService(new URL(soapServiceUrl));
((Stub) sPcspService).setTimeout(soapTimeoutSecs * 1000);
如何为建立连接和打开的连接设置超时? (类似于
org.apache.commons.net.SocketClient
setTimeout()
setotimeout()

我发现一个提示,建议设置如下超时:

FooServiceLocator fooLocator = new FooServiceLocator();
fooLocator.getEngine().setOption("sendMultiRefs", false);
Foo foo = fooLocator.getFooService(new URL(soapServiceUrl));
((Stub) sPcspService).setTimeout(soapTimeoutSecs * 1000);
但是显式强制转换看起来更像是一种黑客行为,而不是官方API的使用

对我找到的引用的源代码进行Grepping

defaultcommonHttpClientProperties.CONNECTION\u DEFAULT\u SO\u TIMEOUT\u KEY


但是我也不知道我是否使用了
Commons HTTP客户端或其他客户端,也不知道如何应用此选项。

我也曾使用axis 1.4和soap来设置存根的超时。在您的示例中,我将执行以下操作:

FooServiceLocator fooLocator = new FooServiceLocator();
fooLocator.getEngine().setOption("sendMultiRefs", false);
Foo foo = fooLocator.getFooService(new URL(soapServiceUrl));

FooStub binding = (FooStub) foo;
binding.setTimeout(soapTimeoutSecs * 1000);

您的FooStub被扩展到org.apache.axis.client.Stub,如果您通过wsdl2java生成了类,那么您已经得到了它们。

上述解决方案不起作用。使用Axis1.4和Java1.7。事实上,没有一种方法适用于轴读取超时。。惊喜已尝试下面链接中提到的所有选项---/----/--