我有基于tutorial 示例的Spring Web Service。以这种方式配置
@Endpoint
public class HolidayEndpoint {
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest")
public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception {...}
的web.xml
<servlet>
<servlet-name>spring-ws</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<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>/ws/*</url-pattern>
</servlet-mapping>
spring config
<sws:annotation-driven/>
<sws:dynamic-wsdl id="holiday" portTypeName="HumanResource" locationUri="/holidayService/"
targetNamespace="http://mycompany.com/hr/definitions">
<sws:xsd location="/WEB-INF/somexsd.xsd"/>
</sws:dynamic-wsdl>
我应该如何访问它?
我试图在http://localhost:8080/ws/holidayService/holiday
发帖,但服务器返回404
并在日志中写道
开始时
DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping] - Looking for endpoints in application context: WebApplicationContext for namespace 'spring-ws-servlet': startup date [Fri Mar 11 18:41:42 EET 2011]; root of context hierarchy
DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping] - Mapped [{http://mycompany.com/hr/schemas}HolidayRequest] onto endpoint [public void com.mycompany.hr.ws.HolidayEndpoint.handleHolidayRequest(org.jdom.Element) throws java.lang.Exception]
DEBUG [org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping] - Looking for endpoints in application context: WebApplicationContext for namespace 'spring-ws-servlet': startup date [Fri Mar 11 18:41:42 EET 2011]; root of context hierarchy
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider] - Inlining SimpleXsdSchema{http://mycompany.com/hr/schemas}
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.DefaultMessagesProvider] - Looking for elements in schema with target namespace [http://mycompany.com/hr/schemas]
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.DefaultMessagesProvider] - Creating message [{http://mycompany.com/hr/definitions}HolidayRequest]
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.SuffixBasedPortTypesProvider] - Creating port type [{http://mycompany.com/hr/definitions}HumanResource]
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.SuffixBasedPortTypesProvider] - Adding operation [Holiday] to port type [{http://mycompany.com/hr/definitions}HumanResource]
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.Soap11Provider] - Creating binding [{http://mycompany.com/hr/definitions}HumanResourceSoap11]
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.Soap11Provider] - Creating service [{http://mycompany.com/hr/definitions}HumanResourceService]
DEBUG [org.springframework.ws.wsdl.wsdl11.provider.Soap11Provider] - Adding port [HumanResourceSoap11] to service [{http://mycompany.com/hr/definitions}HumanResourceService]
DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - Published WebApplicationContext of servlet 'spring-ws' as ServletContext attribute with name [org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring-ws]
INFO [org.springframework.ws.soap.saaj.SaajSoapMessageFactory] - Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol
DEBUG [org.springframework.ws.soap.saaj.SaajSoapMessageFactory] - Using MessageFactory class [com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl]
DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - No WebServiceMessageFactory found in servlet 'spring-ws': using default
DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - No EndpointExceptionResolvers found, using defaults
DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - No MessageDispatcher found in servlet 'spring-ws': using default
DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - Published [org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition@6fc41e49] as holiday.wsdl
DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - Published [SimpleXsdSchema{http://mycompany.com/hr/schemas}] as org.springframework.xml.xsd.SimpleXsdSchema#0.xsd
按要求
DEBUG [org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter] - Accepting incoming [org.springframework.ws.transport.http.HttpServletConnection@3bd85e85] at [http://localhost:8080/ws/holidayService/holiday]
DEBUG [org.springframework.ws.server.MessageTracing.received] - Received request [SaajSoapMessage HolidayRequest]
DEBUG [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping] - Looking up endpoint for [HolidayRequest]
DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint mapping [org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping@2081ca25] has no mapping for request
DEBUG [org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping] - Looking up endpoint for []
DEBUG [org.springframework.ws.soap.server.SoapMessageDispatcher] - Endpoint mapping [org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping@3ad8326d] has no mapping for request
WARN [org.springframework.ws.server.EndpointNotFound] - No endpoint mapping found for [SaajSoapMessage HolidayRequest]
DEBUG [org.springframework.ws.transport.http.MessageDispatcherServlet] - Successfully completed request
如果您需要一些其他信息,请告诉我。
UPD 没有方案/命名空间的东西。