Spring integration Spring集成中模式的验证
我一直在尝试在Spring集成中实现一个验证拦截器,但运气不好。我的配置的第一部分如下所示:Spring integration Spring集成中模式的验证,spring-integration,Spring Integration,我一直在尝试在Spring集成中实现一个验证拦截器,但运气不好。我的配置的第一部分如下所示: <bean class="org.springframework.ws.server.endpoint.mapping.UriEndpointMapping"> <property name="mappings"> <props> <prop key="http://loc
<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>
索普公司大道
com.predictivesolutions.schema.v1_1
但是,它不会验证XML消息。我们可以使用普通的SpringWS,但我似乎无法让它用于集成(应该是相同的)
我了解到,您可以在解组邮件之前使用拦截器验证邮件,但不确定如何将其连接。这很有趣,您为什么不将您的
拦截器提供给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>
索普公司大道
谢谢,我还是Spring Integration的新手,所以我不知道我可以将其放在EndpointMapping元素上。还有一个问题,我可以将验证错误路由到通道吗?可能是使用自定义EndpointInterceptor
,它扩展自PayloadValidatingInterceptor
。但这是一个新的SO问题,如果你对此有异议的话。