I'm trying to add web services to my project, but I'm having trouble with endpoint mapping. There are many messages about this error, but none of the solutions worked for my situation.
As my own WS was not working, I replaced it with the sample WS from the reference documentation, trying to clear some mistake, but the error remains. I'd like some help to find out what I am doing wrong on this.
Spring 3.1
Spring WS 2.1
Below is all the relevant code, XML and logging:
web.xml
webservices.xmlCode:<servlet> <servlet-name>SpringWsServlet</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>classpath:config/webservices.xml</param-value> </init-param> <init-param> <param-name>transformWsdlLocations</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>SpringWsServlet</servlet-name> <url-pattern>/holidayService/*</url-pattern> </servlet-mapping> <!-- Remaining servlet mappings (Spring MVC) below -->
hr.xsd (straight from Spring WS reference docs)Code:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd"> <!-- context:component-scan is defined in other XML --> <sws:annotation-driven /> <sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" locationUri="/holidayService/" targetNamespace="http://mycompany.com/hr/definitions"> <sws:xsd location="/WEB-INF/classes/hr.xsd" /> </sws:dynamic-wsdl> </beans>
HolidayEndpoint.java (also from reference docs, but stripped to the bone)Code:<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:hr="http://mycompany.com/hr/schemas" elementFormDefault="qualified" targetNamespace="http://mycompany.com/hr/schemas"> <xs:element name="HolidayRequest"> <xs:complexType> <xs:all> <xs:element name="Holiday" type="hr:HolidayType" /> <xs:element name="Employee" type="hr:EmployeeType" /> </xs:all> </xs:complexType> </xs:element> <xs:complexType name="HolidayType"> <xs:sequence> <xs:element name="StartDate" type="xs:date" /> <xs:element name="EndDate" type="xs:date" /> </xs:sequence> </xs:complexType> <xs:complexType name="EmployeeType"> <xs:sequence> <xs:element name="Number" type="xs:integer" /> <xs:element name="FirstName" type="xs:string" /> <xs:element name="LastName" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema>
Logs, requesting the WSDLCode:package myproject.webservice; import org.jdom.Element; import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.RequestPayload; @Endpoint public class HolidayEndpoint { private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas"; @PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest") public void handleHolidayRequest(@RequestPayload Element holidayRequest) { System.out.println(holidayRequest); } }
(message too long, see next post)Code:2012-06-22 15:28:03,727 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Initializing servlet 'SpringWsServlet' 2012-06-22 15:28:03,814 INFO [org.springframework.ws.transport.http.MessageDispatcherServlet] : FrameworkServlet 'SpringWsServlet': initialization started 2012-06-22 15:28:03,820 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Servlet with name 'SpringWsServlet' will try to create custom WebApplicationContext context of class 'org.springframework.web.context.support.XmlWebApplicationContext', using parent context [Root WebApplicationContext: startup date [Fri Jun 22 15:27:05 BRT 2012]; root of context hierarchy] 2012-06-22 15:28:04,220 INFO [org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping] : Supporting [WS-Addressing August 2004, WS-Addressing 1.0] 2012-06-22 15:28:04,315 DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping] : Looking for endpoints in application context: WebApplicationContext for namespace 'SpringWsServlet-servlet': startup date [Fri Jun 22 15:28:03 BRT 2012]; parent: Root WebApplicationContext 2012-06-22 15:28:04,385 DEBUG [org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping] : Looking for endpoints in application context: WebApplicationContext for namespace 'SpringWsServlet-servlet': startup date [Fri Jun 22 15:28:03 BRT 2012]; parent: Root WebApplicationContext 2012-06-22 15:28:04,982 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider] : Inlining SimpleXsdSchema{http://mycompany.com/hr/schemas} 2012-06-22 15:28:04,993 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.DefaultMessagesProvider] : Looking for elements in schema with target namespace [http://mycompany.com/hr/schemas] 2012-06-22 15:28:04,997 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.DefaultMessagesProvider] : Creating message [{http://mycompany.com/hr/definitions}HolidayRequest] 2012-06-22 15:28:05,005 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.SuffixBasedPortTypesProvider] : Creating port type [{http://mycompany.com/hr/definitions}HumanResource] 2012-06-22 15:28:05,044 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.SuffixBasedPortTypesProvider] : Adding operation [Holiday] to port type [{http://mycompany.com/hr/definitions}HumanResource] 2012-06-22 15:28:05,049 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.Soap11Provider] : Creating binding [{http://mycompany.com/hr/definitions}HumanResourceSoap11] 2012-06-22 15:28:05,073 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.Soap11Provider] : Creating service [{http://mycompany.com/hr/definitions}HumanResourceService] 2012-06-22 15:28:05,077 DEBUG [org.springframework.ws.wsdl.wsdl11.provider.Soap11Provider] : Adding port [HumanResourceSoap11] to service [{http://mycompany.com/hr/definitions}HumanResourceService] 2012-06-22 15:28:05,108 INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFactory] : Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol 2012-06-22 15:28:05,118 DEBUG [org.springframework.ws.soap.saaj.SaajSoapMessageFactory] : Using MessageFactory class [weblogic.xml.saaj.MessageFactoryImpl] 2012-06-22 15:28:05,121 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : No WebServiceMessageFactory found in servlet 'SpringWsServlet': using default 2012-06-22 15:28:05,135 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : No MessageDispatcher found in servlet 'SpringWsServlet': using default 2012-06-22 15:28:05,137 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Published [org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition@16a5f5b] as holiday.wsdl 2012-06-22 15:28:05,138 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Published [SimpleXsdSchema{http://mycompany.com/hr/schemas}] as org.springframework.xml.xsd.SimpleXsdSchema#0.xsd 2012-06-22 15:28:05,138 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Published WebApplicationContext of servlet 'SpringWsServlet' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.SpringWsServlet] 2012-06-22 15:28:05,139 INFO [org.springframework.ws.transport.http.MessageDispatcherServlet] : FrameworkServlet 'SpringWsServlet': initialization completed in 1319 ms 2012-06-22 15:28:05,139 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Servlet 'SpringWsServlet' configured successfully 2012-06-22 15:28:05,192 TRACE [org.springframework.ws.transport.http.MessageDispatcherServlet] : Bound request context to thread: weblogic.servlet.internal.ServletRequestImpl@84d72d[ GET /appcontext/holidayService/holiday.wsdl HTTP/1.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Cookie: JSESSIONID=S9YqPk1DYhhNQPSbyBRkRQw0WmBR259SvzyKqpMn7GW1rJXF3YkB!-1497159531 ] 2012-06-22 15:28:05,252 DEBUG [org.springframework.ws.transport.http.WsdlDefinitionHandlerAdapter] : Transforming [/holidayService/] to [http://192.168.1.1:7001/appcontext/holidayService/] 2012-06-22 15:28:05,275 TRACE [org.springframework.ws.transport.http.MessageDispatcherServlet] : Cleared thread-bound request context: weblogic.servlet.internal.ServletRequestImpl@84d72d[ GET /appcontext/holidayService/holiday.wsdl HTTP/1.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip, deflate Connection: keep-alive Cookie: JSESSIONID=S9YqPk1DYhhNQPSbyBRkRQw0WmBR259SvzyKqpMn7GW1rJXF3YkB!-1497159531 ] 2012-06-22 15:28:05,276 DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] : Successfully completed request


Reply With Quote
