/ / Validierung des Schemas in Spring Integration - spring-integration

Validierung des Schemas in Spring Integration - Spring-Integration

Ich habe erfolglos versucht, einen validierenden Interceptor in Spring Integration zu implementieren. Der erste Teil meiner Konfiguration sieht so aus:

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

Die XML-Nachricht wird jedoch nicht validiert. Wir haben dies mit normalem Spring WS, aber ich kann es anscheinend nicht für die Integration zum Laufen bringen (die gleich sein sollte).

Ich habe gelesen, dass Sie den Abfangjäger verwenden können, um die Nachricht vor dem Demarshalling zu validieren, aber ich bin mir nicht sicher, wie Sie sie verkabeln sollen.

Antworten:

1 für die Antwort № 1

Es ist interessant, warum gibst du nicht deine interceptor zum 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>