2013-07-30 2 views
0

У меня есть один сервлет Spring WS с двумя конечными точками и двумя файлами wsdl. Запросы/ответы проверяются с помощью 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. Один из вариантов - сделать два отдельных сервлета. Но я хочу использовать только один сервлет.

ответ

1

Решение:

В качестве альтернативы, вы можете использовать или элементы, чтобы указать, для которого корневое имя полезной нагрузки или действия намыливать перехватчик следует применять:

<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> 
Смежные вопросы