Hi ,I am practising on making a Spring WS and consuming that WS using the WebServiceTemplate.
My WSDL runs fine but when i try to consume WS using the WebServiceTemplate i get the following error .
INFO : org.springframework.context.support.FileSystemXmlA pplicationContext - Refreshing org.springframework.context.support.FileSystemXmlA pplicationContext@10a3b24: startup date [Fri Nov 09 10:47:20 CST 2012]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefin itionReader - Loading XML bean definitions from file [C:\SPRINGCONFFILES\test\HelloWorldExample.xml]
INFO : org.springframework.beans.factory.support.DefaultL istableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@737371: defining beans [org.springframework.ws.soap.server.endpoint.SoapFa ultAnnotationExceptionResolver#0,hotelServiceWSTes tClient,messageFactory,marshaller]; root of factory hierarchy
org.springframework.ws.client.core.WebServiceTempl ate@1d9e282
Exception in thread "main" org.springframework.ws.client.WebServiceTransportE xception: Not Found [404]
at org.springframework.ws.client.core.WebServiceTempl ate.handleError(WebServiceTemplate.java:663)
at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:587)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:537)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 384)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 378)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 370)
at com.example.hotelservices.client.HotelServiceWSTes tClient.bookHotelRoom(HotelServiceWSTestClient.jav a:88)
at com.example.hotelservices.client.HotelServiceWSTes tClient.main(HotelServiceWSTestClient.java:103)
The WSDL which gets generated is and ran fine (http://localhost:8080/springhoteroom...elService.wsdl)
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
+ <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:sch="http://localhost:8080/springhoteroombookingws" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://localhost:8080/springhoteroombookingws" targetNamespace="http://localhost:8080/springhoteroombookingws">
the client application context is
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schem...-beans-3.0.xsd
http://www.springframework.org/schema/web-services
http://www.springframework.org/schema/web-services/web-services-2.0.xsd">
<bean
class="org.springframework.ws.soap.server.endpoint .SoapFaultAnnotationExceptionResolver" />
<bean id="hotelServiceWSTestClient" class="com.example.hotelservices.client.HotelServi ceWSTestClient">
<property name="defaultUri" value="http://localhost:8080/springhoteroombookingws/HotelService" />
<property name="marshaller" ref="marshaller" />
<property name="unmarshaller" ref="marshaller" />
<property name="messageFactory" ref="messageFactory" />
<property name="messageSender">
<bean
class="org.springframework.ws.transport.http.HttpU rlConnectionMessageSender">
</bean>
</property>
</bean>
<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory" />
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
<property name="contextPath" value="com.example.hotelservices"/>
</bean>
</beans>


Reply With Quote