[SWS-392] AbstractMarshallingPayloadEndpoint and XStreamMarshaller produces malformed response body Created: 09/Jul/08  Updated: 04/May/12  Resolved: 21/Jul/08

Status: Closed
Project: Spring Web Services
Component/s: OXM
Affects Version/s: 1.5.2
Fix Version/s: 1.5.4

Type: Bug Priority: Major
Reporter: Robert Novotny Assignee: Tareq Abedrabbo
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Windows XP,. Jetty 5, XStream 1.3

Attachments: File SWS-392.patch    


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

Comment by Tareq Abedrabbo [ 15/Jul/08 ]

Patch + unit test.
Robert, thanks for the detailed description.

Comment by Arjen Poutsma [ 21/Jul/08 ]

Fixed. Thanks, both of you.

Comment by Arjen Poutsma [ 04/May/12 ]

Closing old issues

Generated at Wed Oct 24 04:47:50 UTC 2018 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.