2010-02-06 7 views
3

축 관리 클라이언트 인 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()); 
+0

StackOverflow는 포럼이 아닙니다. 자세한 내용을 추가해야하는 경우 [질문 수정] (http://stackoverflow.com/posts/2211578/edit)을 클릭하십시오. 답변은 해당 질문에 대한 추가 정보가 아닌 답변이어야합니다. – Will

답변

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 website에 스레드가 있습니다.

+0

아니요! HTTPConstants.HTTP_METHOD_PARAMS가 존재하지 않습니다. HTTPConstants.HTTP_METHOD를 시도해보십시오. 여전히 시도 중입니다. ( – Leonardo

+0

어떤 축 2 버전을 사용하고 있습니까? HTTPConstants.HTTP_METHOD_PARAMS는 Axis2의 1.5에 존재하기 때문에 http://ws.apache.org/axis2/1_5/api/ org/apache/axis2/transport/http/HTTPConstants.html – rochb

+0

이제 1.5 + 종속성으로 업그레이드 된 Axis2 1.3을 사용했습니다 .. – Leonardo

관련 문제