2013-07-30 28 views
0

我有一個具有兩個端點和兩個wsdl文件的Spring WS servlet。請求/響應正在使用PayloadValidatingInterceptor進行驗證。 spring-ws-servlet.xml的內容:PayloadValidatingInterceptor - 只驗證具體的WSDL

<context:component-scan base-package="cz.legend.mzv.spi.ws.ei.endpoints" /> 
<context:component-scan base-package="cz.legend.mzv.spi.ws.de.endpoints" /> 

<sws:annotation-driven /> 

<sws:static-wsdl id="entityImport" location="classpath:/wsdl/entityImport.wsdl" /> 

<sws:static-wsdl id="documentEvidence" 
    location="classpath:/wsdl/documentEvidence.wsdl" /> 

<oxm:jaxb2-marshaller id="jaxb2Marshaller" 
    contextPath="cz.legend.mzv.spi.ws.jaxb.generated" /> 

<bean id="endpointAdapter" class="org.springframework.ws.server.endpoint.adapter.MarshallingMethodEndpointAdapter"> 
    <constructor-arg ref="jaxb2Marshaller" /> 
</bean> 

<sws:interceptors> 
    <bean 
     class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor"> 
     <property name="schema" value="classpath:/xsd/vums_spi_de.xsd" /> 
     <property name="validateRequest" value="true" /> 
     <property name="validateResponse" value="true" /> 
    </bean> 
</sws:interceptors> 

攔截器應用於兩種服務。我需要攔截器僅適用於documentEvidence.wsdl描述的服務。一種選擇是製作兩個獨立的彈簧servlet。但是我只想使用一個servlet。

回答

1

解決方案:

或者,你可以使用或 元素指定其有效載荷根名稱或SOAP動作 攔截應適用:

<sws:interceptors> <bean class="samples.MyGlobalInterceptor"/> <sws:payloadRoot namespaceUri="http://www.example.com"> <bean class="samples.MyPayloadRootInterceptor"/> 
     </sws:payloadRoot> <sws:soapAction value="http://www.example.com/SoapAction"> 
     <bean class="samples.MySoapActionInterceptor1"/> <ref bean="mySoapActionInterceptor2"/> 
     </sws:soapAction> </sws:interceptors>