Announcement Announcement Module
Collapse
No announcement yet.
Add more PayloadValidatingInterceptor to PayloadRootAnnotationMethodEndpointMapping Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Add more PayloadValidatingInterceptor to PayloadRootAnnotationMethodEndpointMapping

    Hi,
    I got a problem when i tried to add more than one PayloadValidatingInterceptor to the PayloadRootAnnotationMethodEndpointMapping. When i tried to add it i got error no end point found.

    Code:

    <bean id="supportSchema" class="org.springframework.xml.xsd.SimpleXsdSchema ">
    <property name="xsd" value="classpath:/ws/SupportService.xsd"/>
    </bean>

    <bean id="SupportService"
    class="org.springframework.ws.wsdl.wsdl11.DefaultW sdl11Definition">
    <property name="schema" ref="supportSchema" />
    <property name="portTypeName" value="Support" />
    <property name="locationUri"
    value="......." />
    <property name="targetNamespace" value="...." />
    <property name="requestSuffix" value="Request" />
    <property name="responseSuffix" value="Response" />
    <property name="createSoap12Binding" value="false" />
    <property name="createSoap11Binding" value="true" />
    </bean>

    For 2nd schema file

    Code:

    <bean id="subscriptionSchema" class="org.springframework.xml.xsd.SimpleXsdSchema ">
    <property name="xsd" value="classpath:/com/ect/rbt/core/service/business/ws/SubscriptionService.xsd" />
    </bean>


    <bean id="SubscriptionService"
    class="org.springframework.ws.wsdl.wsdl11.DefaultW sdl11Definition">
    <property name="schema" ref="subscriptionSchema" />
    <property name="portTypeName" value="Subscription" />
    <property name="locationUri"
    value="......." />
    <property name="targetNamespace" value="......." />
    <property name="requestSuffix" value="Request" />
    <property name="responseSuffix" value="Response" />
    <property name="createSoap12Binding" value="false" />
    <property name="createSoap11Binding" value="true" />
    </bean>


    Code:

    <bean id="serviceMapping"
    class="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping">
    <property name="interceptors">
    <list>

    <ref bean="subscriptionValidationInterceptor"/>
    <ref bean="supportValidationInterceptor"/>
    <bean class="org.springframework.ws.server.endpoint.inte rceptor.PayloadLoggingInterceptor" />
    </list>
    </property>
    <property name="order" value="1" />
    </bean>

    <bean id="supportValidationInterceptor" class="org.springframework.ws.soap.server.endpoint .interceptor.PayloadValidatingInterceptor">
    <property name="xsdSchema" ref="supportSchema" />
    <property name="validateRequest" value="true" />
    <property name="validateResponse" value="false" />
    </bean>

    <bean id="subscriptionValidationInterceptor" class="org.springframework.ws.soap.server.endpoint .interceptor.PayloadValidatingInterceptor">
    <property name="xsdSchema" ref="subscriptionSchema" />
    <property name="validateRequest" value="true" />
    <property name="validateResponse" value="false" />
    </bean>

    If i add two validation interceptor then it throw exception. Am i doing any wrong here or is there any alternative way?

  • #2
    If the interceptor does not know an element it throws an exception. So supportValidationInterceptor fails when it encounters an element from subscritpionSchema. The solution is to use more schemas in one interceptor like this

    Code:
    <bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
        <description>
            This bean wrap the messages.xsd (which imports types.xsd), and inlines them as a one.
        </description>
        <property name="xsds">
            <list>
                <value>/WEB-INF/xsds/Orders.xsd</value>
                <value>/WEB-INF/xsds/Customers.xsd</value>
            </list>
        </property>
        <property name="inline" value="true"/>
    </bean>

    Comment

    Working...
    X