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

AbstractMarshallingPayloadEndpoint and XStreamMarshaller produces malformed response body


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


      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:

      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:

      <SOAP-ENV:Envelope xmlns:SOAP-ENV="..../">

      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

      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


        novotnyr Robert Novotny created issue -
        arjen.poutsma Arjen Poutsma made changes -
        Field Original Value New Value
        Original Estimate 0.5d [ 14400 ]
        Remaining Estimate 0.5d [ 14400 ]
        Fix Version/s 1.5.4 [ 11016 ]
        tareq Tareq Abedrabbo made changes -
        Assignee Arjen Poutsma [ arjen.poutsma ] Tareq Abed Rabbo [ tareq ]
        tareq Tareq Abedrabbo made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        tareq Tareq Abedrabbo made changes -
        Attachment SWS-392.patch [ 14392 ]
        arjen.poutsma Arjen Poutsma made changes -
        Resolution Fixed [ 1 ]
        Status In Progress [ 3 ] Resolved [ 5 ]
        arjen.poutsma Arjen Poutsma made changes -
        Status Resolved [ 5 ] Closed [ 6 ]


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


            • Created: