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

Payload unmarshalling fails when soap body element attribute references namespace declared in envelope

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.5.7
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Sun's SAAJ 1.3 implementation
      Java SE 1.5

      Description

      Unmarshalling of a message like [1] fails. A payload source reference, which in SaajSoapMessage case is DOMSource of soap body, is given to unmarshaller. Since attribute namespace is declared in soap envelope, unmarshaller, in my case CastorMarshaller, it seems can not find attribute namespace declaration by just using Source nodes. Not sure if it is spring-ws-core or spring-oxm / CastorMarshaller issue, or if it is spring-ws issue at all (could be Castor 1.2 issue).

      Oddly enough unmarshalling of message like [2] works well. Both messages are valid XML documents, and in both cases body content is not a valid XML document, but with difference that in case [1] unmarshalling fails, while in [2] it is successful.

      [1] example of message for which unmarshalling fails

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.foo.com/bar/ns1/" xmlns:ns2="http://www.foo.com/bar/ns2/">
         <soapenv:Header/>
         <soapenv:Body>
            <ns1:DoSomethingRequest ns2:anAttribute="attributeValue" />
         </soapenv:Body>
      </soapenv:Envelope>

      [2] example of message for which unmarshalling is successful

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.foo.com/bar/ns1/">
         <soapenv:Header/>
         <soapenv:Body>
            <ns1:DoSomethingRequest />
         </soapenv:Body>
      </soapenv:Envelope>

        Issue Links

          Activity

          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Added formatting.

          Show
          arjen.poutsma Arjen Poutsma added a comment - Added formatting.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          This is a Castor issue, I think. As you said, the SaajSoapMessage simple returns a DOMSource wrapping the original SAAJ SOAPElement. In the CastorMarshaller, we simply something like:

          Unmarshaller castorMarshaller = ...
          Node node = ((DOMSource)source).getNode();
          castorMarshaller.unmarshal(node);

          As stated in SWS-523, a related issue, we don't manipulate the DOM tree at all for getPayloadSource(), since that would result in a lot of overhead which is mostly unnecessary: all the necessary namespace information can be retrieved through querying the DOM tree. The problem described here is that Castor does not seem to do that, while JAXB2 for instance does.

          Show
          arjen.poutsma Arjen Poutsma added a comment - This is a Castor issue, I think. As you said, the SaajSoapMessage simple returns a DOMSource wrapping the original SAAJ SOAPElement. In the CastorMarshaller, we simply something like: Unmarshaller castorMarshaller = ... Node node = ((DOMSource)source).getNode(); castorMarshaller.unmarshal(node); As stated in SWS-523 , a related issue, we don't manipulate the DOM tree at all for getPayloadSource(), since that would result in a lot of overhead which is mostly unnecessary: all the necessary namespace information can be retrieved through querying the DOM tree. The problem described here is that Castor does not seem to do that, while JAXB2 for instance does.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Closing old issues

          Show
          arjen.poutsma Arjen Poutsma added a comment - Closing old issues

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              sslavic Stevo Slavić
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: