看來,軸管理客戶端org.apache.axis2.client.ServiceClient 發出org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry()和 重試就像默認3次。有沒有辦法設置不重試?AXIS2如何設置連接重試?
我的代碼:
ServiceClient client = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference(strWebServiceUrl));
opts.setAction(strNameOfMethodToInvoke);
opts.setTimeOutInMilliSeconds(timeOut);
client.setOptions(opts);
OMElement res = client.sendReceive(createRequest());
return (res.toString());
代碼現在是
ServiceClient client = new ServiceClient();
Options opts = new Options();
opts.setTo(new EndpointReference(strWebServiceUrl));
opts.setAction("urn:" + strNameOfMethodToInvoke);
opts.setTimeOutInMilliSeconds(timeOut);
HttpMethodParams methodParams = new HttpMethodParams();
DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(0, false);
methodParams.setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
opts.setProperty(HTTPConstants.HTTP_METHOD_PARAMS, methodParams);
client.setOptions(opts);
OMElement res = client.sendReceive(createRequest());
return (res.toString());
StackOverflow不是論壇;如果您需要添加更多詳細信息,請[編輯您的問題](http://stackoverflow.com/posts/2211578/edit)。答案應該是答案,而不是關於問題的附加信息。 – Will