Author: veithen
Date: Sat Apr  9 11:33:05 2011
New Revision: 1090570

URL: http://svn.apache.org/viewvc?rev=1090570&view=rev
Log:
Avoid the DOM->Axiom conversion if the underlying Axiom implementation supports 
DOM. Note that this doesn't apply to DOOM (because DOOM is an incomplete 
implementation of the Axiom API), but to implementations such as DDOM 
[http://code.google.com/p/ddom/].

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=1090570&r1=1090569&r2=1090570&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 11:33:05 2011
@@ -185,6 +185,17 @@ public class Axis2Util {
        public static SOAPEnvelope getSOAPEnvelopeFromDOMDocument(Document doc, 
boolean useDoom)
             throws WSSecurityException {
 
+           Element documentElement = doc.getDocumentElement();
+           if (documentElement instanceof SOAPEnvelope) {
+               SOAPEnvelope env = (SOAPEnvelope)documentElement;
+               // If the DOM tree already implements the Axiom API and is not 
DOOM, then just return
+               // the SOAPEnvelope directly, i.e. we assume that any Axiom+DOM 
implementation other
+               // than DOOM implements enough of the Axiom API to support the 
Axis2 runtime.
+               if (!(env.getOMFactory() instanceof DOMSOAPFactory)) {
+                   return env;
+               }
+           }
+           
         if(useDoom) {
             try {
                 //Get processed headers


Reply via email to