Skip to content

AxiomContentHandler should empty the response body before adding the transformation result [SWS-266] #423

Closed
@gregturn

Description

@gregturn

Laurent Bihanic opened SWS-266 and commented

AxiomContentHandler append the result of the XSLT transformation without first emptying the response body. The resulting SOAP response ends up with 2 body child elements : the original (untransformed) endpoint response and the transformation result.

The following patch fixes the problem :

--- ../spring-ws-1.0.3/modules/core/src/main/java/org/springframework/ws/soap/axiom/AxiomContentHandler.java 2007-12-21 16:26:32.000000000 +0100
+++ AxiomContentHandler.java 2008-01-08 15:14:41.000000000 +0100
@@ -16,6 +16,7 @@

package org.springframework.ws.soap.axiom;

+import org.apache.axiom.om.OMNode;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.SAXOMBuilder;
import org.springframework.util.Assert;
@@ -39,6 +40,15 @@

public void endDocument() throws SAXException {
    super.endDocument();
  // Remove original (i.e. source) response body.
  OMNode child = null;
  while ((child = parentElement.getFirstOMChild()) != null)
  {
  child.detach();
  }
  // Set result (i.e. transformed) response body.
  parentElement.addChild(super.getRootElement());

}
}


Affects: 1.0.3

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions