seb*_*ner 3 java rest soap axis2 timeout
我在版本中使用Axis2:
Implementation-Version: 1.7.0-SNAPSHOT
Implementation-Vendor-Id: org.apache.axis2
Implementation-Vendor: The Apache Software Foundation
Jenkins-Build-Number: 1847
Run Code Online (Sandbox Code Playgroud)
我想将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());
Run Code Online (Sandbox Code Playgroud)
但是我仍然在日志中看到:
org.apache.axis2.AxisFault:主机在60000毫秒的超时时间内未接受连接
而且确实需要60秒。因此,错误消息不仅是错误的,而且似乎只是忽略了超时选项,并且始终使用默认选项。
有人有类似的问题吗?
由于
塞巴斯蒂安
我能够解决此问题(尽管看起来好像对我来说有些重复)
int timeOutInMilliSeconds = 2000;
options.setTimeOutInMilliSeconds(timeOutInMilliSeconds);
options.setProperty(HTTPConstants.SO_TIMEOUT, timeOutInMilliSeconds);
options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, timeOutInMilliSeconds);
Run Code Online (Sandbox Code Playgroud)
塞巴斯蒂安
| 归档时间: |
|
| 查看次数: |
10838 次 |
| 最近记录: |