3

Axis 管理クライアント org.apache.axis2.client.ServiceClient が org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry() を発行しているようで、リトライはデフォルトで 3 回のようです。リトライしないように設定する方法はありますか?

私のコード:

        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());
4

1 に答える 1

4

パラメータを使用して設定できHttpMethodParams.RETRY_HANDLERます。あなたの場合、例えば:

HttpMethodParams methodParams = new HttpMethodParams();
DefaultHttpMethodRetryHandler retryHandler = new DefaultHttpMethodRetryHandler(0, false);
methodParams.setParameter(HttpMethodParams.RETRY_HANDLER, retryHandler);
opts.setProperty(HTTPConstants.HTTP_METHOD_PARAMS, methodParams);

wso2.org Web サイトにスレッドがあります。

于 2010-02-06T14:25:27.330 に答える