Reputation: 165
I have been trying to implment a validating interceptor in Spring Integration with no luck. The first part of my configuration looks like this:
<bean
class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping">
<property name="mappings">
<props>
<prop key="http://localhost/ws/CompanyService">SOAPCompanyGateway</prop>
</props>
</property>
</bean>
<int-ws:inbound-gateway id="SOAPCompanyGateway"
request-channel="SOAPCompanyRequestChannel" marshaller="SOAPMarshaller" unmarshaller="SOAPMarshaller"/>
<bean id="validatingInterceptor"
class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
<property name="schema" value="/WEB-INF/classes/schema/v1_1/CompanyService.xsd"/>
<property name="validateRequest" value="true"/>
<property name="validateResponse" value="false"/>
</bean>
<bean id="SOAPMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPaths">
<list>
<!-- list all schema versions that we wish to accept -->
<value>com.predictivesolutions.schema.v1_1</value>
</list>
</property>
</bean>
However its not validating the XML message. We have this working with normal Spring WS, but I cannot seem to get it working for Integration (which should be the same).
I read that you can use the interceptor to validate the message before unmarshalling, but not sure how to wire it.
Upvotes: 0
Views: 424
Reputation: 121337
It's interest why don't you provide your interceptor
to the EndpointMapping
?
<bean class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping">
<property name="mappings">
<props>
<prop key="http://localhost/ws/CompanyService">SOAPCompanyGateway</prop>
</props>
</property>
<property name="interceptors">
<array>
<ref bean="validatingInterceptor"/>
</array>
</property>
</bean>
Upvotes: 1