【发布时间】:2012-11-11 10:35:06
【问题描述】:
我正在使用 Axis2 版本:
Implementation-Version: 1.7.0-SNAPSHOT
Implementation-Vendor-Id: org.apache.axis2
Implementation-Vendor: The Apache Software Foundation
Jenkins-Build-Number: 1847
我想设置ServiceClient的超时时间为2000毫秒,这是我们的代码:
Options options = new Options();
options.setTo(new EndpointReference(getUserServiceEndPoint()));
options.setProperty(Constants.Configuration.ENABLE_REST,
Constants.VALUE_TRUE);
// setting timeout to 2 second should be sufficient, if the server is
// not available within the 3 second interval you got a problem anyway
options.setTimeOutInMilliSeconds(2000);
ServiceClient sender = new ServiceClient();
sender.engageModule(new QName(Constants.MODULE_ADDRESSING)
.getLocalPart());
sender.setOptions(options);
OMElement getSessionResult = sender
.sendReceive(getPayloadMethodGetSession());
但我仍然在日志中看到:
org.apache.axis2.AxisFault:主机不接受连接 在 60000 毫秒的超时内
而且确实也需要 60 秒。所以错误信息不仅仅是错误的,似乎只是忽略了超时选项,它总是使用默认选项。
有人遇到过类似的问题吗?
谢谢
塞巴斯蒂安
【问题讨论】:
标签: java rest soap timeout axis2