2016-04-07 1 views
0

Я использую фреймворк весенних веб-сервисов для вызова некоторой SOAP-apis. Моя конфигурация выглядит так:Время ожидания весенних веб-сервисов

<bean name="wsTemplate" class="org.springframework.ws.client.core.WebServiceTemplate" scope="prototype" > 
    <constructor-arg ref="messageFactory" /> 
    <property name="marshaller" ref="marshaller"/> 
    <property name="unmarshaller" ref="unmarshaller"/> 
</bean> 

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"> 
    <property name="soapVersion"> 
     <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_11"/> 
    </property> 
</bean> 

<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller" > 
    <property name="contextPaths"> 
     <list> 
      some configured classes here 
     </list> 
    </property> 
</bean> 
<bean id="unmarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller" > 
    <property name="contextPaths"> 
     <list> 
      some configured classes here 
     </list> 
    </property> 
</bean> 

Примечание Я использую рамки прототипа. Я не уверен, что это может вызвать проблемы.

В моем Java коде я использую WebServiceTemplate так:

@PostConstruct 
private void init() { 

    try { 
     String uri = "https://web/file.svc?wsdl" 
     webServiceTemplate.setDefaultUri(uri);    
    } catch (Exception exception) { 
     logger.error("Error creating URL for the wsdl location.", exception); 
    } 

} 

Я называю WebService так:

Response response = (Response) webServiceTemplate.marshalSendAndReceive(request, new SoapActionCallback(SOAP_ACTION_URL)); 

Я получаю следующее чтение тайм-аут исключение, которое я не уверен, что Я читал это потому, что ответ слишком велик, но на самом деле это не так. Это не больше 100K

org.springframework.ws.client.WebServiceIOException: Ошибка ввода-вывода: время чтения; вложенное исключение - это java.net.SocketTimeoutException: время ожидания чтения: 15: 27: 49,028 INFO [stdout] (задание по умолчанию-22) в org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive (WebServiceTemplate.java:561) ~ [spring-ws-core-2.2.4.RELEASE.jar: 2.2.4.RELEASE] 15: 27: 49 028 INFO [stdout] (задание по умолчанию-22) в org.springframework.ws.client.core.WebServiceTemplate. marshalSendAndReceive (WebServiceTemplate.java:390) ~ [spring-ws-core-2.2.4.RELEASE.jar: 2.2.4.RELEASE] 15: 27: 49 028 INFO [stdout] (задание по умолчанию-22) в org.springframework .ws.client.core.WebServiceTemplate.marshalSendAndReceive (WebServiceTemplate.java:383) ~ [spring-ws-core-2.2.4.RELEASE.jar: 2.2.4.RELEASE]

В чем может быть проблема? Я не знаю

+0

http://stackoverflow.com/questions/6733744/how-to-set-timeout-in-spring-webservicetemplate – VirtualTroll

ответ

0

В конце концов, я не уверен, в чем проблема, но я решил это, установив отправителя сообщения другому провайдеру. Я поставил его в какой-то апача библиотеки

<bean name="wsTemplate" class="org.springframework.ws.client.core.WebServiceTemplate" scope="prototype" > 
    <constructor-arg ref="messageFactory" /> 
    <property name="marshaller" ref="marshaller"/> 
    <property name="unmarshaller" ref="unmarshaller"/> 
    <property name="messageSender"> 
     <bean class="org.springframework.ws.transport.http.HttpComponentsMessageSender" /> 
    </property> 
</bean> 
Смежные вопросы