cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1299782 - in /cxf/trunk: api/src/main/java/org/apache/cxf/helpers/ rt/core/src/main/java/org/apache/cxf/databinding/source/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/...
Date Mon, 12 Mar 2012 18:51:29 GMT
Author: dkulp
Date: Mon Mar 12 18:51:28 2012
New Revision: 1299782

URL: http://svn.apache.org/viewvc?rev=1299782&view=rev
Log:
More updates for working with different SAAJ implementations

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/CXF4130Provider.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
    cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/SecurityHeaderCacheInterceptor.java

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java (original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/helpers/DOMUtils.java Mon Mar 12 18:51:28 2012
@@ -45,6 +45,7 @@ import javax.xml.transform.stream.Stream
 import javax.xml.transform.stream.StreamSource;
 
 import org.w3c.dom.Attr;
+import org.w3c.dom.Comment;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -103,6 +104,25 @@ public final class DOMUtils {
     }
 
     /**
+     * Get the text content of a node and all it's children or null if there is no text
+     */
+    public static String getAllContent(Node n) {
+        StringBuilder b = new StringBuilder();
+        getAllContent(n, b);
+        return b.toString();
+    }
+    private static void getAllContent(Node n, StringBuilder b) {
+        Node nd = n.getFirstChild();
+        while (nd != null) {
+            if (nd instanceof Text && !(nd instanceof Comment)) {
+                b.append(((Text)nd).getData());
+            } else {
+                getAllContent(nd, b);
+            }
+            nd = nd.getNextSibling();
+        }
+    }
+    /**
      * Get the trimmed text content of a node or null if there is no text
      */
     public static String getContent(Node n) {

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataWriter.java
Mon Mar 12 18:51:28 2012
@@ -60,25 +60,7 @@ public class XMLStreamDataWriter impleme
                 reader.close();
             } else if (obj instanceof Node) {
                 Node nd = (Node)obj;
-                if (writer instanceof W3CDOMStreamWriter
-                    && ((W3CDOMStreamWriter)writer).getCurrentNode() != null) {
-                    W3CDOMStreamWriter dw = (W3CDOMStreamWriter)writer;
-                    
-                    if (nd.getOwnerDocument() == dw.getCurrentNode().getOwnerDocument())
{
-                        dw.getCurrentNode().appendChild(nd);
-                        return;
-                    } else if (nd instanceof DocumentFragment) {
-                        nd = dw.getDocument().importNode(nd, true);
-                        dw.getCurrentNode().appendChild(nd);
-                        return;
-                    }
-                }
-                if (nd instanceof Document) {
-                    StaxUtils.writeDocument((Document)nd,
-                                            writer, false, true);
-                } else {
-                    StaxUtils.writeNode(nd, writer, true);                    
-                }
+                writeNode(nd, writer);
             } else {
                 Source s = (Source) obj;
                 if (s instanceof DOMSource
@@ -95,6 +77,47 @@ public class XMLStreamDataWriter impleme
         }
     }
 
+    private void writeNode(Node nd, XMLStreamWriter writer) throws XMLStreamException {
+        if (writer instanceof W3CDOMStreamWriter) {
+            W3CDOMStreamWriter dw = (W3CDOMStreamWriter)writer;
+            
+            if (dw.getCurrentNode() != null) {
+                if (nd instanceof DocumentFragment
+                    && nd.getOwnerDocument() == dw.getCurrentNode().getOwnerDocument())
{
+                    Node ch = nd.getFirstChild();
+                    while (ch != null) {
+                        nd.removeChild(ch);
+                        dw.getCurrentNode().appendChild(ch);
+                        ch = nd.getFirstChild();
+                    }
+                } else if (nd.getOwnerDocument() == dw.getCurrentNode().getOwnerDocument())
{
+                    dw.getCurrentNode().appendChild(nd);
+                    return;
+                } else if (nd instanceof DocumentFragment) {
+                    nd = dw.getDocument().importNode(nd, true);
+                    dw.getCurrentNode().appendChild(nd);
+                    return;
+                }
+            } else if (dw.getCurrentFragment() != null) {
+                if (nd.getOwnerDocument() == dw.getCurrentFragment().getOwnerDocument())
{
+                    dw.getCurrentFragment().appendChild(nd);
+                    return;
+                } else if (nd instanceof DocumentFragment) {
+                    nd = dw.getDocument().importNode(nd, true);
+                    dw.getCurrentFragment().appendChild(nd);
+                    return;
+                }
+            }
+        }
+        if (nd instanceof Document) {
+            StaxUtils.writeDocument((Document)nd,
+                                    writer, false, true);
+        } else {
+            StaxUtils.writeNode(nd, writer, true);                    
+        }
+
+    }
+
     public void setSchema(Schema s) {
     }
 

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Mon Mar
12 18:51:28 2012
@@ -60,6 +60,7 @@ import org.apache.cxf.binding.soap.model
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
@@ -460,7 +461,7 @@ public class DispatchImpl<T> implements 
     private String getPayloadElementName(SOAPMessage soapMessage) {
         try {            
             // we only care about the first element node, not text nodes
-            Element element = DOMUtils.getFirstElement(soapMessage.getSOAPBody());
+            Element element = DOMUtils.getFirstElement(SAAJUtils.getBody(soapMessage));
             if (element != null) {
                 return DOMUtils.getElementQName(element).toString();
             }

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalHandlerOutInterceptor.java
Mon Mar 12 18:51:28 2012
@@ -72,8 +72,21 @@ public class LogicalHandlerOutIntercepto
         try {
             
             XMLStreamWriter origWriter = message.getContent(XMLStreamWriter.class);
-            Document document = XMLUtils.newDocument();
-            message.setContent(Node.class, document);
+            
+            Node nd = message.getContent(Node.class);
+            SOAPMessage m = message.getContent(SOAPMessage.class);
+            Document document = null;
+            
+            if (m != null) {
+                document = m.getSOAPPart();
+            } else if (nd != null) {
+                document = nd.getOwnerDocument();
+            } else {
+                document = XMLUtils.newDocument();
+                message.setContent(Node.class, document);
+                nd = document;
+            }
+            
             W3CDOMStreamWriter writer = new W3CDOMStreamWriter(document.createDocumentFragment());
         
             // Replace stax writer with DomStreamWriter

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/logical/LogicalMessageImpl.java
Mon Mar 12 18:51:28 2012
@@ -40,6 +40,7 @@ import javax.xml.ws.LogicalMessage;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
 
+import org.w3c.dom.DocumentFragment;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -164,7 +165,7 @@ public class LogicalMessageImpl implemen
                     StaxUtils.copy(obj, cos);
                     InputStream in = cos.getInputStream();
                     SOAPMessage msg = initSOAPMessage(in);
-                    source = new DOMSource(msg.getSOAPBody().getFirstChild());
+                    source = new DOMSource(SAAJUtils.getBody(msg).getFirstChild());
                     in.close();
                     cos.close();
                 } catch (Exception e) {
@@ -194,7 +195,7 @@ public class LogicalMessageImpl implemen
                         // REVISIT: should try to use the original SOAPMessage
                         // instead of creating a new empty one.
                         SOAPMessage msg = initSOAPMessage(null);
-                        write(s, msg.getSOAPBody());
+                        write(s, SAAJUtils.getBody(msg));
                         s = new DOMSource(msg.getSOAPPart());
                     } catch (Exception e) {
                         throw new Fault(e);
@@ -215,6 +216,22 @@ public class LogicalMessageImpl implemen
 
     public Object getPayload(JAXBContext arg0) {
         try {
+            Source s = getPayload();
+            if (s instanceof DOMSource) {
+                DOMSource ds = (DOMSource)s;
+                Node parent = ds.getNode().getParentNode();
+                Node next = ds.getNode().getNextSibling();
+                if (parent instanceof DocumentFragment) {
+                    parent.removeChild(ds.getNode());
+                }
+                try {
+                    return arg0.createUnmarshaller().unmarshal(ds);
+                } finally {
+                    if (parent instanceof DocumentFragment) {
+                        parent.insertBefore(ds.getNode(), next);
+                    }
+                }
+            } 
             return arg0.createUnmarshaller().unmarshal(getPayload());
         } catch (JAXBException e) {
             throw new WebServiceException(e);

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/MessageModeOutInterceptor.java
Mon Mar 12 18:51:28 2012
@@ -43,6 +43,8 @@ import org.apache.cxf.binding.soap.SoapM
 import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor.SAAJOutEndingInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJStreamWriter;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor;
 import org.apache.cxf.interceptor.Fault;
@@ -202,7 +204,7 @@ public class MessageModeOutInterceptor e
                     soapMessage = factory.createMessage();
                     SOAPPart part = soapMessage.getSOAPPart();
                     if (o instanceof Source) {
-                        StaxUtils.copy((Source)o, new W3CDOMStreamWriter(part));
+                        StaxUtils.copy((Source)o, new SAAJStreamWriter(part));
                     }
                 } catch (SOAPException e) {
                     throw new SoapFault("Error creating SOAPMessage", e, 
@@ -227,12 +229,12 @@ public class MessageModeOutInterceptor e
 
             DocumentFragment frag = soapMessage.getSOAPPart().createDocumentFragment();
             try {
-                Node body = soapMessage.getSOAPBody();
+                Node body = SAAJUtils.getBody(soapMessage);
                 Node nd = body.getFirstChild();
                 while (nd != null) {
                     body.removeChild(nd);
                     frag.appendChild(nd);
-                    nd = soapMessage.getSOAPBody().getFirstChild();
+                    nd = SAAJUtils.getBody(soapMessage).getFirstChild();
                 }
                 
                 int index = 0;

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/PolicyBasedWSS4JOutInterceptor.java
Mon Mar 12 18:51:28 2012
@@ -31,6 +31,7 @@ import org.w3c.dom.Element;
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
@@ -142,8 +143,8 @@ public class PolicyBasedWSS4JOutIntercep
                     }
                     try {
                         //move to end
-                        saaj.getSOAPHeader().removeChild(el);
-                        saaj.getSOAPHeader().appendChild(el);
+                        SAAJUtils.getHeader(saaj).removeChild(el);
+                        SAAJUtils.getHeader(saaj).appendChild(el);
                     } catch (SOAPException e) {
                         //ignore
                     }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/WSS4JInInterceptor.java
Mon Mar 12 18:51:28 2012
@@ -46,6 +46,7 @@ import org.apache.cxf.binding.soap.SoapF
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.SoapVersion;
 import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -288,7 +289,10 @@ public class WSS4JInInterceptor extends 
                 storeTimestamp(msg, reqData, wsResult);
                 checkActions(msg, reqData, wsResult, actions);
                 doResults(
-                    msg, actor, doc.getSOAPHeader(), doc.getSOAPBody(), wsResult, utWithCallbacks
+                    msg, actor, 
+                    SAAJUtils.getHeader(doc),
+                    SAAJUtils.getBody(doc),
+                    wsResult, utWithCallbacks
                 );
             } else { // no security header found
                 // Create an empty result list to pass into the required validation
@@ -307,13 +311,19 @@ public class WSS4JInInterceptor extends 
                     // the unasserted assertions will provide confirmation that
                     // security was not sufficient.
                     // checkActions(msg, reqData, wsResult, actions);
-                    doResults(msg, actor, doc.getSOAPHeader(), doc.getSOAPBody(), wsResult);
+                    doResults(msg, actor, 
+                              SAAJUtils.getHeader(doc),
+                              SAAJUtils.getBody(doc),
+                              wsResult);
                 } else {
                     checkActions(msg, reqData, wsResult, actions);
-                    doResults(msg, actor, doc.getSOAPHeader(), doc.getSOAPBody(), wsResult);
+                    doResults(msg, actor,
+                              SAAJUtils.getHeader(doc),
+                              SAAJUtils.getBody(doc),
+                              wsResult);
                 }
             }
-            advanceBody(msg, doc.getSOAPBody());
+            advanceBody(msg, SAAJUtils.getBody(doc));
             SAAJInInterceptor.replaceHeaders(doc, msg);
 
             if (doTimeLog) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/AbstractBindingBuilder.java
Mon Mar 12 18:51:28 2012
@@ -55,6 +55,7 @@ import org.w3c.dom.NodeList;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
@@ -1041,12 +1042,25 @@ public abstract class AbstractBindingBui
         } else {
             //Add an id
             id = "Id-" + elem.hashCode();
-            String pfx = elem.lookupPrefix(PolicyConstants.WSU_NAMESPACE_URI);
+            String pfx = null;
+            try {
+                pfx = elem.lookupPrefix(PolicyConstants.WSU_NAMESPACE_URI);
+            } catch (Throwable t) {
+                pfx = DOMUtils.getPrefixRecursive(elem, PolicyConstants.WSU_NAMESPACE_URI);
+            }
             boolean found = !StringUtils.isEmpty(pfx);
             int cnt = 0;
             while (StringUtils.isEmpty(pfx)) {
                 pfx = "wsu" + (cnt == 0 ? "" : cnt);
-                if (!StringUtils.isEmpty(elem.lookupNamespaceURI(pfx))) {
+                
+                String ns;
+                try { 
+                    ns = elem.lookupNamespaceURI(pfx);
+                } catch (Throwable t) {
+                    ns = DOMUtils.getNamespace(elem, pfx);
+                }
+                
+                if (!StringUtils.isEmpty(ns)) {
                     pfx = null;
                     cnt++;
                 }
@@ -1260,21 +1274,21 @@ public abstract class AbstractBindingBui
         
         List<WSEncryptionPart> result = new ArrayList<WSEncryptionPart>();
         
-        if (includeBody && !found.contains(this.saaj.getSOAPBody())) {
-            found.add(saaj.getSOAPBody());
-            final String id = this.addWsuIdToElement(this.saaj.getSOAPBody());
+        if (includeBody && !found.contains(SAAJUtils.getBody(this.saaj))) {
+            found.add(SAAJUtils.getBody(saaj));
+            final String id = this.addWsuIdToElement(SAAJUtils.getBody(this.saaj));
             if (sign) {
                 WSEncryptionPart bodyPart = new WSEncryptionPart(id, "Element");
-                bodyPart.setElement(this.saaj.getSOAPBody());
+                bodyPart.setElement(SAAJUtils.getBody(this.saaj));
                 result.add(bodyPart);
             } else {
                 WSEncryptionPart bodyPart = new WSEncryptionPart(id, "Content");
-                bodyPart.setElement(this.saaj.getSOAPBody());
+                bodyPart.setElement(SAAJUtils.getBody(this.saaj));
                 result.add(bodyPart);
             }
         }
         
-        final SOAPHeader header = saaj.getSOAPHeader();
+        final SOAPHeader header = SAAJUtils.getHeader(saaj);
         
         // Handle sign/enc parts
         for (WSEncryptionPart part : parts) {

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/TransportBindingHandler.java
Mon Mar 12 18:51:28 2012
@@ -32,6 +32,7 @@ import org.w3c.dom.Element;
 
 
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.AssertionInfoMap;
@@ -335,7 +336,7 @@ public class TransportBindingHandler ext
         
         if (signedParts != null) {
             if (signedParts.isBody()) {
-                WSEncryptionPart bodyPart = convertToEncryptionPart(saaj.getSOAPBody());
+                WSEncryptionPart bodyPart = convertToEncryptionPart(SAAJUtils.getBody(saaj));
                 sigParts.add(bodyPart);
             }
             for (Header header : signedParts.getHeaders()) {
@@ -422,7 +423,7 @@ public class TransportBindingHandler ext
         
         if (signdParts != null) {
             if (signdParts.isBody()) {
-                WSEncryptionPart bodyPart = convertToEncryptionPart(saaj.getSOAPBody());
+                WSEncryptionPart bodyPart = convertToEncryptionPart(SAAJUtils.getBody(saaj));
                 sigParts.add(bodyPart);
             }
             if (secTok.getX509Certificate() != null) {

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/dispatch/DispatchClientServerTest.java
Mon Mar 12 18:51:28 2012
@@ -56,6 +56,7 @@ import org.xml.sax.InputSource;
 
 
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.XMLUtils;
@@ -283,8 +284,9 @@ public class DispatchClientServerTest ex
         
         assertNotNull(soapResMsg);
         String expected = "Hello TestSOAPInputMessage";
-        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, soapResMsg.getSOAPBody()
-            .getTextContent().trim());
+        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, 
+                     DOMUtils.getContent(SAAJUtils.getBody(soapResMsg)
+                                             .getFirstChild().getFirstChild()).trim());
 
         // Test oneway
         InputStream is1 = getClass().getResourceAsStream("resources/GreetMe1WDocLiteralReq2.xml");
@@ -301,8 +303,8 @@ public class DispatchClientServerTest ex
         SOAPMessage soapResMsg2 = (SOAPMessage)response.get();
         assertNotNull(soapResMsg2);
         String expected2 = "Hello TestSOAPInputMessage2";
-        assertEquals("Response should be : Hello TestSOAPInputMessage2", expected2, soapResMsg2.getSOAPBody()
-            .getTextContent().trim());
+        assertEquals("Response should be : Hello TestSOAPInputMessage2", expected2, 
+                     DOMUtils.getContent(SAAJUtils.getBody(soapResMsg2).getFirstChild().getFirstChild()));
 
 
         // Test async callback
         InputStream is3 = getClass().getResourceAsStream("resources/GreetMeDocLiteralReq3.xml");
@@ -344,8 +346,8 @@ public class DispatchClientServerTest ex
         
         assertNotNull(soapResMsg);
         String expected = "Hello TestSOAPInputMessage";
-        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, soapResMsg.getSOAPBody()
-            .getTextContent().trim());
+        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, 
+                     DOMUtils.getAllContent(SAAJUtils.getBody(soapResMsg)).trim());
     }
     
     @Test
@@ -374,11 +376,10 @@ public class DispatchClientServerTest ex
         assertNotNull(domResMsg);
         String expected = "Hello TestSOAPInputMessage";
 
-        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, domResMsg.getNode()
-            .getFirstChild().getTextContent().trim());
+        assertEquals("Response should be : Hello TestSOAPInputMessage", expected, 
+                     DOMUtils.getAllContent(domResMsg.getNode().getFirstChild()).trim());
         
         Element el = (Element)domResMsg.getNode().getFirstChild();
-        System.out.println(DOMUtils.getElementQName(el));
         assertEquals("gmns", el.lookupPrefix("http://apache.org/hello_world_soap_http/types"));
         assertEquals("http://apache.org/hello_world_soap_http/types", 
                      el.lookupNamespaceURI("gmns"));
@@ -868,7 +869,7 @@ public class DispatchClientServerTest ex
         public void handleResponse(Response<SOAPMessage> response) {
             try {
                 SOAPMessage reply = response.get();
-                replyBuffer = reply.getSOAPBody().getTextContent();
+                replyBuffer = DOMUtils.getContent(SAAJUtils.getBody(reply).getFirstChild().getFirstChild());
             } catch (Exception e) {
                 //e.printStackTrace();
             }

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/DispatchHandlerInvocationTest.java
Mon Mar 12 18:51:28 2012
@@ -158,6 +158,7 @@ public class DispatchHandlerInvocationTe
         InputStream is = this.getClass().getResourceAsStream("resources/GreetMeDocLiteralReq.xml");
         MessageFactory factory = MessageFactory.newInstance();
         SOAPMessage soapReq = factory.createMessage(null, is);
+        soapReq.saveChanges();
         DOMSource domReqMessage = new DOMSource(soapReq.getSOAPPart());
 
         DOMSource response = disp.invoke(domReqMessage);

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Mon Mar 12 18:51:28 2012
@@ -59,7 +59,6 @@ import javax.xml.ws.soap.SOAPFaultExcept
 import org.w3c.dom.Element;
 
 import org.apache.cxf.common.util.PackageUtils;
-import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 import org.apache.cxf.testutil.common.TestUtil;
@@ -799,12 +798,11 @@ public class HandlerInvocationTest exten
             assertNotNull(detail);
             
             QName nn = new QName("http://gizmos.com/orders/", "order");
-            Iterator<Element> it = CastUtils.cast(detail.getChildElements(nn));
-            assertTrue(it.hasNext());
-            Element el = it.next();
+            Element el = DOMUtils.getFirstChildWithName(detail, nn);
+            assertNotNull(el);
             el.normalize();
             assertEquals("Quantity element does not have a value", el.getFirstChild().getNodeValue());
-            el = it.next();
+            el = DOMUtils.getNextElement(el);
             el.normalize();
             assertEquals("Incomplete address: no zip code", el.getFirstChild().getNodeValue());
         }        

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/jaxws/ClientServerMiscTest.java
Mon Mar 12 18:51:28 2012
@@ -231,7 +231,7 @@ public class ClientServerMiscTest extend
             resp = port.greetMe(req);
             fail("did not get fault back");
         } catch (SOAPFaultException ex) {
-            assertFalse(ex.getFault().hasDetail());
+            assertNull(ex.getFault().getDetail());
         }
         
         GMonthTest gm = new GMonthTest();

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/CXF4130Provider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/CXF4130Provider.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/CXF4130Provider.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/CXF4130Provider.java
Mon Mar 12 18:51:28 2012
@@ -30,9 +30,11 @@ import javax.xml.ws.WebServiceContext;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.WebServiceProvider;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
+import org.apache.cxf.helpers.DOMUtils;
+
 @WebServiceProvider(serviceName = "InBandSoapHeaderService",
     targetNamespace = "http://cxf.apache.org/soapheader/inband", 
     portName = "InBandSoapHeaderSoapHttpPort", 
@@ -45,8 +47,7 @@ public class CXF4130Provider implements 
 
     public SOAPMessage invoke(SOAPMessage request) {
         try {
-            Document soapBodyDomDocument = request.getSOAPBody().extractContentAsDocument();
-            Node node = soapBodyDomDocument.getDocumentElement();
+            Node node = DOMUtils.getFirstElement(SAAJUtils.getBody(request));
             String requestMsgName = node.getLocalName();
             String responseText = null;
 

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageDocProvider.java
Mon Mar 12 18:51:28 2012
@@ -43,6 +43,7 @@ import javax.xml.ws.soap.SOAPFaultExcept
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.helpers.DOMUtils;
 
 //The following wsdl file is used.
@@ -86,9 +87,8 @@ public class HWSoapMessageDocProvider im
         SOAPMessage response = null;        
         SOAPBody body = null;
         try {
-            body = request.getSOAPBody();
+            body = SAAJUtils.getBody(request);
         } catch (SOAPException e) {
-            e.printStackTrace();
             return null;
         }
         Node n = body.getFirstChild();
@@ -101,7 +101,6 @@ public class HWSoapMessageDocProvider im
         } else if (n.getLocalName().equals(greetMe.getLocalPart())) {
             Element el = DOMUtils.getFirstElement(n);
             String v = DOMUtils.getContent(el);
-            System.out.println(v);
             if (v.contains("Return sayHi")) {
                 response = sayHiResponse;
             } else if (v.contains("throwFault")) {

Modified: cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/provider/HWSoapMessageProvider.java
Mon Mar 12 18:51:28 2012
@@ -34,6 +34,7 @@ import javax.xml.ws.WebServiceProvider;
 
 import org.w3c.dom.Node;
 
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.helpers.CastUtils;
 
 //The following wsdl file is used.
@@ -71,7 +72,7 @@ public class HWSoapMessageProvider imple
     public SOAPMessage invoke(SOAPMessage request) {
         SOAPMessage response = null;        
         try {
-            SOAPBody body = request.getSOAPBody();
+            SOAPBody body = SAAJUtils.getBody(request);
             Node n = body.getFirstChild();
 
             while (n.getNodeType() != Node.ELEMENT_NODE) {

Modified: cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/SecurityHeaderCacheInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/SecurityHeaderCacheInterceptor.java?rev=1299782&r1=1299781&r2=1299782&view=diff
==============================================================================
--- cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/SecurityHeaderCacheInterceptor.java
(original)
+++ cxf/trunk/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/SecurityHeaderCacheInterceptor.java
Mon Mar 12 18:51:28 2012
@@ -32,6 +32,7 @@ import javax.xml.soap.SOAPHeaderElement;
 import javax.xml.soap.SOAPMessage;
 
 import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.saaj.SAAJUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.Phase;
@@ -59,7 +60,7 @@ public class SecurityHeaderCacheIntercep
         if (cachedSecurityHeader == null) {
             try {
                 Iterator<?> cachedHeadersIterator = 
-                    saaj.getSOAPHeader().getChildElements(SEC_HEADER);
+                    SAAJUtils.getHeader(saaj).getChildElements(SEC_HEADER);
                 if (cachedHeadersIterator.hasNext()) {
                     cachedSecurityHeader = (SOAPHeaderElement)cachedHeadersIterator.next();
                 }
@@ -71,7 +72,7 @@ public class SecurityHeaderCacheIntercep
                 saaj.getSOAPHeader().removeContents();
                 
                 SOAPHeaderElement secHeaderElement = 
-                    saaj.getSOAPHeader().addHeaderElement(SEC_HEADER);
+                    SAAJUtils.getHeader(saaj).addHeaderElement(SEC_HEADER);
                 
                 Iterator<?> cachedHeadersIterator = 
                     cachedSecurityHeader.getChildElements();



Mime
View raw message