Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-176

PayloadValidatingInterceptor ignores schema list

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0.1
    • Component/s: Core
    • Labels:
      None
    • Environment:
      winXP, tomcat, eclipse 3.2, JDK 5.11 & 6.2
       

      Description

      see http://forum.springframework.org/showthread.php?t=26685

      when using more than one schema element for PayloadValidatingInterceptor it only uses the first in the list. in the example below if i send a request that needs to use the LocationService.xsd file i get "2007-08-24 10:56:28,015 WARN endpoint.interceptor.PayloadValidatingInterceptor - XML validation error on request: cvc-elt.1: Cannot find the declaration of element 'm:GetDistanceRequest'.: m:GetDistanceRequest' is a root element of the LocationService.xsd file.

      <property name="schemas">
      <list>
      <value>/WEB-INF/xsd/VehicleLookupService.xsd</value>
      <value>/WEB-INF/xsd/LocationService.xsd</value>
      </list>
      </property>

        Activity

        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        I've tried to reproduce this, I even wrote some additional unit tests. See http://springframework.svn.sourceforge.net/svnroot/springframework/spring-ws/trunk/xml/src/test/java/org/springframework/xml/validation/AbstractValidatorFactoryTestCase.java, the testMultipleSchemasValidMessage method.

        Show
        arjen.poutsma Arjen Poutsma added a comment - I've tried to reproduce this, I even wrote some additional unit tests. See http://springframework.svn.sourceforge.net/svnroot/springframework/spring-ws/trunk/xml/src/test/java/org/springframework/xml/validation/AbstractValidatorFactoryTestCase.java , the testMultipleSchemasValidMessage method.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing 1.0.1 issues.

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing 1.0.1 issues.
        Hide
        stuchl4n3k Petr Stuchlik added a comment -

        Hi. So I stumbled on this exact problem after almost 9 years. I managed to reproduce the issue - check out https://github.com/stuchl4n3k/sws-176

        It seems, that when using a bit more complex schema (imports, includes, inheritance, ...) may trigger this one.

        Show
        stuchl4n3k Petr Stuchlik added a comment - Hi. So I stumbled on this exact problem after almost 9 years. I managed to reproduce the issue - check out https://github.com/stuchl4n3k/sws-176 It seems, that when using a bit more complex schema (imports, includes, inheritance, ...) may trigger this one.
        Hide
        stuchl4n3k Petr Stuchlik added a comment -

        If it helps I'm running Linux 64bit with JDK 1.8 64bit and building with Apache Maven 3.3.9.

        Show
        stuchl4n3k Petr Stuchlik added a comment - If it helps I'm running Linux 64bit with JDK 1.8 64bit and building with Apache Maven 3.3.9.
        Hide
        stuchl4n3k Petr Stuchlik added a comment -

        Also, as a workaround I'm now using an extra PayloadValidatingInterceptor bean for each WS XSD.

        Show
        stuchl4n3k Petr Stuchlik added a comment - Also, as a workaround I'm now using an extra PayloadValidatingInterceptor bean for each WS XSD.
        Hide
        mihael.sedmak Mihael added a comment -

        @petr stuchlick - Petr, what do you mean by "using an extra

         PayloadValidatingInterceptor
        

        bean for each WS XSD" ? I have tried to add a new

         PayloadValidatingInterceptor
        

        to the interceptors list, but I still get the behaviour you described in the bug description.

        Show
        mihael.sedmak Mihael added a comment - @petr stuchlick - Petr, what do you mean by "using an extra PayloadValidatingInterceptor bean for each WS XSD" ? I have tried to add a new PayloadValidatingInterceptor to the interceptors list, but I still get the behaviour you described in the bug description.
        Hide
        stuchl4n3k Petr Stuchlik added a comment -

        @mihael Create an interceptor bean for each WS XSD/namespace - see a snippet from my ws-endpoint-definition.xml below:

            <!-- Web-services use a specific validating Interceptor for each namespace. -->
            <ws:interceptors>
                <ws:payloadRoot namespaceUri="http://example.com/ws/ws1">
                    <ref bean="payloadValidatingInterceptor_ofWebService1"/>
                </ws:payloadRoot>
                <ws:payloadRoot namespaceUri="http://http://example.com/ws/ws2">
                    <ref bean="payloadValidatingInterceptor_ofWebService2"/>
                </ws:payloadRoot>
            </ws:interceptors>
         
            <bean id="payloadValidatingInterceptor_ofWebService1"
                  class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
                <property name="schemas">
                    <list>
                        <value>classpath*:xsd/WebService1.xsd</value>
                    </list>
                </property>
                <property name="validateRequest" value="true"/>
                <property name="validateResponse" value="false"/>
            </bean>
            <bean id="payloadValidatingInterceptor_ofWebService2"
                  class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
                <property name="schemas">
                    <list>
                        <value>classpath*:xsd/WebService2.xsd</value>
                    </list>
                </property>
                <property name="validateRequest" value="true"/>
                <property name="validateResponse" value="false"/>
            </bean>
        

        Show
        stuchl4n3k Petr Stuchlik added a comment - @mihael Create an interceptor bean for each WS XSD/namespace - see a snippet from my ws-endpoint-definition.xml below: <!-- Web-services use a specific validating Interceptor for each namespace. --> <ws:interceptors> <ws:payloadRoot namespaceUri="http://example.com/ws/ws1"> <ref bean="payloadValidatingInterceptor_ofWebService1"/> </ws:payloadRoot> <ws:payloadRoot namespaceUri="http://http://example.com/ws/ws2"> <ref bean="payloadValidatingInterceptor_ofWebService2"/> </ws:payloadRoot> </ws:interceptors>   <bean id="payloadValidatingInterceptor_ofWebService1" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor"> <property name="schemas"> <list> <value>classpath*:xsd/WebService1.xsd</value> </list> </property> <property name="validateRequest" value="true"/> <property name="validateResponse" value="false"/> </bean> <bean id="payloadValidatingInterceptor_ofWebService2" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor"> <property name="schemas"> <list> <value>classpath*:xsd/WebService2.xsd</value> </list> </property> <property name="validateRequest" value="true"/> <property name="validateResponse" value="false"/> </bean>

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            denov deno vichas
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: