Hi guys, I've an unsolved problem and I'm getting crazy working on it. Therefore if someone could help doing me this favor, just check what is wrong. I have this service that works very well if I use SOAP UI as test:
customer.xsd
spring-ws-context.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:customer="http://localhost/dataTest/services" elementFormDefault="qualified" targetNamespace="http://localhost/dataTest/services"> <xs:element name="client"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:int"/> <xs:element name="first_name" type="xs:string"/> <xs:element name="last_name" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="customerRequest"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:int"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="customerResponse"> <xs:complexType> <xs:sequence> <xs:element ref="customer:client"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
web.xmlCode:<context:component-scan base-package="spring.service"/> <sws:annotation-driven/> <sws:dynamic-wsdl id="customer" portTypeName="customer" locationUri="/services/" targetNamespace="http://localhost/dataTest/services"> <sws:xsd location="/WEB-INF/services/customer.xsd"/> </sws:dynamic-wsdl>
Code:<servlet> <servlet-name>spring-ws</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/config/spring-ws-context.xml</param-value> </init-param> <init-param> <param-name>transformWsdlLocations</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>spring-ws</servlet-name> <url-pattern>/services/*</url-pattern> </servlet-mapping>But if I try to develop the client side in this way:Code:<bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"> <property name="messageFactory" ref="messageFactory"/> <property name="messageSender" ref="messageSender"/> <property name="marshaller" ref="msh"/> <property name="unmarshaller" ref="msh"/> <property name="defaultUri" value="http://localhost/dataTest/services"/> </bean> <bean id="msh" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="classesToBeBound"> <list> <value>spring.schema.CustomerRequest</value> <value>spring.schema.CustomerResponse</value> </list> </property> </bean> <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"/> <bean id="messageSender" class="org.springframework.ws.transport.http.HttpUrlConnectionMessageSender"/>
I got the following response:Code:public Customer doIt(long Id) { CustomerRequest customerRequest = new CustomerRequest(); customerRequest.setId(id); CustomerResponse customerResponse = (CustomerResponse) webServiceTemplate.marshalSendAndReceive("http://localhost:8080/dataTest/services/",customerRequest); return customerResponse; }
which is basically a 404 error, service not found, I guess. I'm really hopeless...Code:2011-08-30 14:36:50,893 [main] INFO org.springframework.ws.soap.saaj.SaajSoapMessageFactory - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol 2011-08-30 14:36:50,895 [main] DEBUG org.springframework.ws.soap.saaj.SaajSoapMessageFactory - Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl] 2011-08-30 14:36:51,449 [main] INFO org.springframework.ws.soap.saaj.SaajSoapMessageFactory - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol 2011-08-30 14:36:51,452 [main] DEBUG org.springframework.ws.soap.saaj.SaajSoapMessageFactory - Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl] 2011-08-30 14:36:51,634 [main] INFO org.springframework.ws.soap.saaj.SaajSoapMessageFactory - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol 2011-08-30 14:36:51,635 [main] DEBUG org.springframework.ws.soap.saaj.SaajSoapMessageFactory - Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl] 2011-08-30 14:36:51,693 [main] DEBUG org.springframework.ws.client.core.WebServiceTemplate - Opening [org.springframework.ws.transport.http.HttpUrlConnection@f9f91d] to [http://localhost:8080/dataTest/services/] 2011-08-30 14:36:51,809 [main] DEBUG org.springframework.ws.client.MessageTracing.sent - Sent request [SaajSoapMessage customerRequest] 2011-08-30 14:36:52,237 [main] DEBUG org.springframework.ws.client.core.WebServiceTemplate - Received error for request [SaajSoapMessage customerRequest]
Thank you in advance



Reply With Quote
))
