honzee
honzee

Reputation: 11

PayloadValidatingInterceptor - validate only concrete wsdl

I have one Spring WS servlet with two endpoints and two wsdl files. Requests/responses are being validated with PayloadValidatingInterceptor. Content of spring-ws-servlet.xml:

<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>

Interceptor is applied on both services. I need the interceptor to be applied only on service described by documentEvidence.wsdl. One option is to make two separate spring servlets. But I want to use only one servlet.

Upvotes: 0

Views: 1909

Answers (1)

honzee
honzee

Reputation: 11

Solution:

Alternatively, you can use or elements to specify for which payload root name or SOAP action the interceptor should apply:

<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>

Upvotes: 1

Related Questions