0
我想向Spring MVC應用程序添加一個可使用的合同優先web服務 - 該應用程序是web服務提供者。在web.xml
我添加了應該採取的請求照顧第二個servlet:Spring WS似乎忽略映射端點
<servlet>
<servlet-name>webservices</servlet-name>
<servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:/webservices-servlet.xml</param-value>
</init-param>
<init-param>
<param-name>transformWsdlLocations</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webservices</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
webservices-servlet.xml
包含:
<context:component-scan base-package="de.y.application" />
<sws:static-wsdl id="yAdaptorService" location="/WEB-INF/wsdl/yAdapterService.wsdl" />
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<bean
class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />
<bean
class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="schema" value="/WEB-INF/wsdl/ResourceAdapter.xsd" />
<property name="validateRequest" value="true" />
<property name="validateResponse" value="true" />
</bean>
</list>
</property>
<property name="order" value="1" />
</bean>
當應用程序部署在Tomcat的7開始WSDL部署在 http://localhost:8080/application/services/yAdapterService.wsdl
相關的WSDL片段:
<message name="pingRequest">
</message>
<message name="pingResponse">
</message>
<portType name="yAdaptor">
<operation name="ping">
<input message="tns:pingRequest"></input>
<output message="tns:pingResponse"></output>
</operation>
</portType>
<binding name="SoapBinding" type="tns:yAdapter">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="ping">
<wsdlsoap:operation soapAction="urn:webservice.y.x.com:wsdl/ping"/>
<input>
<wsdlsoap:body use="literal"/>
</input>
<output>
<wsdlsoap:body use="literal"/>
</output>
</operation>
</binding>
<service name="yAdapterService">
<port binding="tns:SoapBinding" name="yAdapterSoapPort">
<wsdlsoap:address location="http://localhost:8080/application/services/yAdapterService"/>
</port>
</service>
設置記錄到調試級別,Tomcat的告訴我,在啓動過程中:
09 Jan 2014 12:20:49,247 DEBUG org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping:105 - Mapped [{urn:webservice.x.com:wsdl}ping] onto endpoint [public void de.y.yAdapterService.ping()]
但是,當通過涉及到一個簡單的ping請求SOAP-UI
SOAPAction: urn:webservice.x.com:wsdl/ping
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body/>
</soapenv:Envelope>
本端點
private static final String NAMESPACE_URI = "urn:webservice.x.com:wsdl";
@Override
@PayloadRoot(localPart = "ping", namespace = NAMESPACE_URI)
public void ping()
{
System.out.println("ping pong");
}
m apped endpoint can not be found
/* SOAP-UI REQUEST ON urn:webservice.x.com:wsdl/ping */
09 Jan 2014 12:21:44,808 DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter:136 - Opening JPA EntityManager in OpenEntityManagerInViewFilter
09 Jan 2014 12:21:44,818 DEBUG org.springframework.security.util.FilterChainProxy:205 - Converted URL to lowercase, from: '/services/yadapterservice'; to: '/services/yadapterservice'
09 Jan 2014 12:21:44,818 DEBUG org.springframework.security.util.FilterChainProxy:212 - Candidate is: '/services/yadapterservice'; pattern is /services/**; matched=true
09 Jan 2014 12:21:44,818 DEBUG org.springframework.security.util.FilterChainProxy:165 - has an empty filter list
09 Jan 2014 12:21:44,827 DEBUG org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter:114 - Accepting incoming [[email protected]95be] at [http://localhost:8080/application/services/yAdapterService]
09 Jan 2014 12:21:44,864 DEBUG org.springframework.ws.server.MessageTracing.received:171 - Received request [SaajSoapMessage]
09 Jan 2014 12:21:44,875 DEBUG org.springframework.ws.soap.server.SoapMessageDispatcher:278 - Endpoint mapping [org.springframework.ws.ser[email protected]b64f867] has no mapping for request
09 Jan 2014 12:21:44,876 WARN org.springframework.ws.server.EndpointNotFound:241 - No endpoint mapping found for [SaajSoapMessage]
09 Jan 2014 12:21:44,877 DEBUG org.springframework.ws.transport.http.MessageDispatcherServlet:966 - Successfully completed request
09 Jan 2014 12:21:44,877 DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter:154 - Closing JPA EntityManager in OpenEntityManagerInViewFilter
09 Jan 2014 12:21:44,878 DEBUG org.springframework.orm.jpa.EntityManagerFactoryUtils:338 - Closing JPA EntityManager
我在想什麼?爲什麼最初映射的端點未找到?
發佈您提出的請求。 –
添加了SOAP請求 – actc
您希望消息的有效負載上的映射響應soap動作...... Payload!= SoapAction ... –