Month: June 2014

Spring WS WebServiceTransportException: Not Found [404]

The main reason for that error to be thrown is endpoint is not correct when your Web Service client is making a call to service based on SOAP.

Error log.
———————————————————–

org.springframework.ws.client.WebServiceTransportException:NotFound[404]
    at org.springframework.ws.client.core.WebServiceTemplate.handleError(WebServiceTemplate.java:626)
    at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:550)
    at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:501)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:350)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:344)
    at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:336)

How to fix it.

1. if you are making a call from java class and passing Default Web Service URI  of End Point , please check URL that’s incorrect that’s why you get 404 error.

2. if you passing from application context.xml. correct there.

Code snippet.

JAVA

final SoapActionCallback soapActionCallback = new SoapActionCallback(“http://ws.cdyne.com/WeatherWS/GetCityForecastByZIP”);

XML:
<beans:bean id=”weatherServiceTemplate” class=”org.springframework.ws.client.core.WebServiceTemplate”>
        <beans:constructor-arg ref=”messageFactory” />
        <beans:property name=”marshaller” ref=”weatherServiceMarshaller”></beans:property>
        <beans:property name=”unmarshaller” ref=”weatherServiceMarshaller”></beans:property>        
        <beans:property name=”defaultUri” value=”http://wsf.cdyne.com/WeatherWS/Weather.asmx&#8221; />
    </beans:bean>