Author: veithen Date: Sat Apr 9 08:18:17 2011 New Revision: 1090540 URL: http://svn.apache.org/viewvc?rev=1090540&view=rev Log: Fixed an issue that occurs in the outflow when the Axiom implementation also supports DOM.
Modified: axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java Modified: axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java URL: http://svn.apache.org/viewvc/axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java?rev=1090540&r1=1090539&r2=1090540&view=diff ============================================================================== --- axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java (original) +++ axis/axis2/java/rampart/trunk/modules/rampart-core/src/main/java/org/apache/rampart/util/Axis2Util.java Sat Apr 9 08:18:17 2011 @@ -90,7 +90,18 @@ public class Axis2Util { throws WSSecurityException { try { if(env instanceof Element) { - return ((Element)env).getOwnerDocument(); + Element element = (Element)env; + Document document = element.getOwnerDocument(); + // For outgoing messages, Axis2 only creates the SOAPEnvelope, but no document. If + // the Axiom implementation also supports DOM, then the envelope (seen as a DOM + // element) will have an owner document, but the document and the envelope have no + // parent-child relationship. On the other hand, the input expected by WSS4J is + // a document with the envelope as document element. Therefore we need to set the + // envelope as document element on the owner document. + if (element.getParentNode() != document) { + document.appendChild(element); + } + return document; } if (useDoom) {