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

PayloadValidatingInterceptor refuses to validate correct message with a top-level attribute

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.2
    • Fix Version/s: 1.5 M1, 1.0.3
    • Component/s: XML
    • Labels:
      None
    • Environment:
      Java 1.6.0_03 on amd64 linux
      Running in JBoss 4.2.0.ga

      Description

      With the following schema:
      <element name="EchoMessageRequest">
      <complexType>
      <attribute name="message" type="string"/>
      </complexType>
      </element>

      I attempt to submit the message:
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://www.example.com/soap-test/schemas">
      <soapenv:Header/>
      <soapenv:Body>
      <sch:EchoMessageRequest message="hello world"/>
      </soapenv:Body>
      </soapenv:Envelope>

      And I get the response:
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
      <SOAP-ENV:Header/>
      <SOAP-ENV:Body>
      <SOAP-ENV:Fault>
      <faultcode>SOAP-ENV:Client</faultcode>
      <faultstring xml:lang="en">Validation error</faultstring>
      <detail>
      <spring-ws:ValidationError xmlns:spring-ws="http://springframework.org/spring-ws">cvc-complex-type.3.2.2: Attribute 'message' is not allowed to appear in element 'sch:EchoMessageRequest'.</spring-ws:ValidationError>
      </detail>
      </SOAP-ENV:Fault>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      I wrote a small handler that takes XML and attempts to validate it against the same schema the PayloadValidatingInterceptor uses, and it reports no problem.

      I am attaching a minimal project which reproduces this issue. I used SOAPui to test but this seems to be independent of the client.

        Activity

        Hide
        katre John Cater added a comment -

        This is a minimal maven project which creates soap-test-1.0.war. I loaded it into JBoss as soap-test.war.

        The WSDL is available at http://localhost:8080/soap-test/soap-test.wsdl

        The custom validator is at http://localhost:8080/soap-test/validator

        Show
        katre John Cater added a comment - This is a minimal maven project which creates soap-test-1.0.war. I loaded it into JBoss as soap-test.war. The WSDL is available at http://localhost:8080/soap-test/soap-test.wsdl The custom validator is at http://localhost:8080/soap-test/validator
        Hide
        katre John Cater added a comment -

        As a note, I verified that JBoss has a recent version of both xerces and xalan available in the endorsed classpath. I upgraded these to the latest (xalan 2.7.0 and xercesImpl 2.8.1) and the problem persisted.

        Show
        katre John Cater added a comment - As a note, I verified that JBoss has a recent version of both xerces and xalan available in the endorsed classpath. I upgraded these to the latest (xalan 2.7.0 and xercesImpl 2.8.1) and the problem persisted.
        Hide
        katre John Cater added a comment -

        After re-reading the FAQ, I have found the problem. Because I am using Java 1.6, I need to remove the xalan and xercesImpl jars from JBoss's lib/endorsed directory.

        This issue is apparently due to a xerces/java6 incompatability.

        Show
        katre John Cater added a comment - After re-reading the FAQ, I have found the problem. Because I am using Java 1.6, I need to remove the xalan and xercesImpl jars from JBoss's lib/endorsed directory. This issue is apparently due to a xerces/java6 incompatability.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        And removing these from lib/endorsed fixes the problem?

        Show
        arjen.poutsma Arjen Poutsma added a comment - And removing these from lib/endorsed fixes the problem?
        Hide
        katre John Cater added a comment -

        Yes, it does. It still doesn't explain why the validation worked when I did it in the custom handler, but not in the interceptor, but removing those makes the interceptor work properly.

        Show
        katre John Cater added a comment - Yes, it does. It still doesn't explain why the validation worked when I did it in the custom handler, but not in the interceptor, but removing those makes the interceptor work properly.
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Probably has to do with JBoss classloading.

        I'm marking this issue as resolved, thanks for the investigation!

        Show
        arjen.poutsma Arjen Poutsma added a comment - Probably has to do with JBoss classloading. I'm marking this issue as resolved, thanks for the investigation!
        Hide
        arjen.poutsma Arjen Poutsma added a comment -

        Closing issues for 1.5.0 M1

        Show
        arjen.poutsma Arjen Poutsma added a comment - Closing issues for 1.5.0 M1

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            katre John Cater
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: