2017-11-02 9 views
-1

WebserviceTemplate을 사용하여 SOAP 서비스를 호출하는 중에 예외가 발생합니다. 엔드 포인트 url에 연결하기 위해 프록시를 사용하고 있습니다. 웹 서비스를 호출하는 동안 java.net.SocketTimeoutException : 읽기 시간이 초과되었습니다. WebServiceTemplate.sendAndReceive (WebServiceTemplate.java:561)

<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"> 
    <property name="marshaller" ref="jaxb2Marshaller"></property> 
    <property name="unmarshaller" ref="jaxb2Marshaller"></property> 
    <property name="defaultUri"><value>${ws.url}</value></property> 
    <property name="interceptors"> 
     <list> 
      <ref local="wsClientSecurityInterceptor"/> 
     </list> 
    </property> 
    <property name="messageSender" ref="messageSender"></property> 
    </bean> 

    <bean id="messageSender" class="org.springframework.ws.transport.http.CommonsHttpMessageSender"> 
    <constructor-arg ref="httpClient"></constructor-arg> 
    </bean> 

    <!-- This is my custom class to set the proxy --> 
    <bean id="proxyConfig" class="com.somepackage.client.ProxyConfiguration"> 
    <property name="proxyHostPlusPort"><value>${proxy.host}:${proxy.port}</value></property> 
    </bean> 

    <bean id="httpParams" class="org.apache.commons.httpclient.params.HttpClientParams"> 
    <property name="soTimeout" value="120000" /> 
    </bean> 

    <bean id="httpClient" class="org.apache.commons.httpclient.HttpClient"> 
    <property name="hostConfiguration" ref="proxyConfig" /> 
    <property name="params" ref="httpParams" /> 
    </bean> 

    <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> 
    <property name="packagesToScan"> 
     <list><value>com.aaa.wsdl</value></list> 
    </property> 
    </bean> 

    <bean id="wsClientSecurityInterceptor" 
    class="org.springframework.ws.soap.security.wss4j.Wss4jSecurityInterceptor"> 
    <property name="securementActions" value="UsernameToken" /> 
    <property name="securementUsername"><value>${ws.username}</value></property> 
    <property name="securementPassword"><value>${ws.password}</value></property> 
    <property name="securementPasswordType" value="PasswordText" /> 
    </bean> 

가 가끔 예외 아래에 무엇입니까 : 나는 soTimeout, 나는이 문제를 얻고 설정 한 경우에도

org.springframework.ws.client.WebServiceIOException: I/O error: Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out 
at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:561) 
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) 
at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383) 

다음은 내 XML 구성입니다. 내가 의심하는 것은 프록시가 2 분 이상 작동하지 않을 때 문제가 발생한다는 것입니다.

이 문제를 어떻게 해결할 수 있습니까? soTimeout만으로 충분합니까 아니면 더 많은 매개 변수를 설정해야합니까?

감사합니다.

+0

당신은 프록시가 더 신뢰할 수있는 프록시를 사용하여 이외의 다른 두 개 이상의 분 동안 다운되는 제거 얻을 수 없습니다. 네가 묻고있는 것이 불분명하다. – EJP

+0

프록시 또는 실제 종점 시스템에서 실제로 문제인지 여부를 어떻게 확인할 수 있습니까? – rupesh

답변

0

하위 수준 (하드웨어/네트워크) 오류를 무시할 수 없으므로 응용 프로그램에서 인텔리전스을 추가하여 적절히 대응할 수 있습니다.

예를 들어 몇 가지 추가 시도를 수행하는 등 더 강력한 응용 프로그램을 갖기 위해.

여러 번 시도한 후 사용자에게 네트워크 문제가 있음을 알리는 메시지를 보낼 수 있습니다. 즉, 요청을 즉시 이행 할 수 없으며 로거를 사용하여 추적 할 수 있습니다.

이것이 실제로 자주 발생하면 인프라 수준에서 조치를 취해야합니다.

사용 :

-> try/catch, throw exception