Announcement Announcement Module
Collapse
No announcement yet.
Creating response payload containing 2 elements? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Creating response payload containing 2 elements?

    A payload endpoint of mine needs to return the following XML (beyond my control). Unfortunately, I cannot seem to create a response payload containing 2 elements (instead of a single root element).

    I detected this problem too late, and now it is quite urgent. Any help is therefore greatly appreciated!

    Thanks,
    Dan

    Code:
    <SOAP-ENV:Body>
        <SOAP-ENV:Body>
            <ns1:someResponse
                SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:ns1="http://soap.some.example.com">
                <someReturn href="#id0" />
            </ns1:someResponse>
            <multiRef SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                id="id0" soapenc:root="0" xsi:type="soapenc:long"
                xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                1234567
            </multiRef>
        </SOAP-ENV:Body>
    </SOAP-ENV:Body>

  • #2
    Having two payload elements is not WS-I compliant. That's why Spring-WS doesn't make it easy to do.

    You could do it at a SAAJ level, though. Make a MessageEndpoint, get the Response from the message context, cast it to a SaajSoapMessage, and get the raw SAAJ SOAPMessage from that. And call addBodyElement on that, see http://java.sun.com/j2ee/1.4/docs/ap....xml.soap.Name)

    Not pretty, but possible.

    Comment


    • #3
      Thanks Arjen!

      I know it's plain wrong to do this, and I wouldn't if I had a choice. Your suggestion works as advertised though.

      Cheers,
      Dan

      Comment

      Working...
      X