0

I am using spring web services framework to call some SOAP apis. My configuration is like this:

<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>

Note I am using a prototype scope. I am not sure if that could be causing issues.

In my java code I use WebServiceTemplate like this:

@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);
    }

}

I call the webservice like this:

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

I am getting the following read time out exception which I am not sure what it is, I have read it is because the response it is too big, but it really is not. It is not bigger than 100K

org.springframework.ws.client.WebServiceIOException: I/O error: Read timed out; nested exception is java.net.SocketTimeoutException: Read timed out 15:27:49,028 INFO [stdout] (default task-22) at 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] (default task-22) at 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] (default task-22) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383) ~[spring-ws-core-2.2.4.RELEASE.jar:2.2.4.RELEASE]

What could be the issue ? I am clueless

Deibys
  • 619
  • 3
  • 9
  • 18

1 Answers1

0

At the end, I am not sure what was the issue, but I solved it by setting the message sender to a diferent provider . I set it to some apache library

<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>
Deibys
  • 619
  • 3
  • 9
  • 18