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

AbstractMarshallingPayloadEndpoint and XStreamMarshaller produces malformed response body

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.2
    • Fix Version/s: 1.5.4
    • Component/s: OXM
    • Labels:
      None
    • Environment:
      Windows XP,. Jetty 5, XStream 1.3

      Description

      Marshalling and unmarshalling of objects to XML payloads using AbstractMarshallingPayloadEndpoint and XStreamMarshaller seems to generated malformed SOAP Message when using XStream 1.2.1 or newer (XStream 1.2 works without problems).

      The fundamental method of my endpoint looks like this:
      Code:

      protected Object invokeInternal(Object object) throws Exception {

      MovieReservation movieReservationRequest = (MovieReservation) object;

      ReservationConfirmation confirmation = new ReservationConfirmation();
      confirmation.setId(new Date().getDate());
      confirmation.setSeatIds(new int[]

      {1, 2, 3, 4}

      );

      return confirmation;
      }

      The SOAP response, which is malformed, looks as follows:
      Code:

      <SOAP-ENV:Envelope xmlns:SOAP-ENV="..../">
      <SOAP-ENV:Header/>
      <SOAP-ENV:Body/>
      <ReservationConfirmation>
      <id>23</id>
      <seatIds>
      <int>1</int>
      <int>2</int>
      <int>3</int>
      <int>4</int>
      </seatIds>
      </ReservationConfirmation>
      </SOAP-ENV:Envelope>

      Notice the empty header and empty body and the ReservationConfirmation element following the body element (which is incorrect, since this element should be within the body).

      I suspect the Spring org.s.x.oxm.XStreamWriter and its method marshalDomDone which contains the following lines
      Code:

      else if (node instanceof Element)

      { streamWriter = new DomWriter((Element) node); }

      However, sometimes between XStream 1.2 and XStream 1.3 the functionality of DomWriter has changed. This is described on the XStream mailing list in the "DOMWriter uses root element for marshalling instead of specified element" topic [1]

      The suggested change is described in that post:"To write into an arbitrary node you have to use the constructor DomWriter(Element, Document, XmlFriendlyReplacer)."

      Shouldn't the XStreamMarshall use the suggested three-param constructor instead of the default?

      [1] http://www.nabble.com/DOMWriter-uses-root-element-for-marshalling-instead-of-specified-element-td16088975.html#a16088975

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        5d 11h 24m 1 Tareq Abedrabbo 15/Jul/08 5:53 AM
        In Progress In Progress Resolved Resolved
        6d 16h 11m 1 Arjen Poutsma 21/Jul/08 10:04 PM
        Resolved Resolved Closed Closed
        1382d 8h 59m 1 Arjen Poutsma 04/May/12 7:03 AM

          People

          • Assignee:
            tareq Tareq Abedrabbo
            Reporter:
            novotnyr Robert Novotny
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: