cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject [1/4] cxf git commit: [CXF-6900] Get Colm's tests working....
Date Wed, 18 May 2016 15:36:03 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes 0ceb6a1d9 -> 01bf5f841


[CXF-6900] Get Colm's tests working....


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a1e4b880
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a1e4b880
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a1e4b880

Branch: refs/heads/3.1.x-fixes
Commit: a1e4b88063404e25e75db25d1022a484300a8ca1
Parents: 0ceb6a1
Author: Daniel Kulp <dkulp@apache.org>
Authored: Tue May 17 12:13:14 2016 -0400
Committer: Alessio Soldano <asoldano@redhat.com>
Committed: Wed May 18 14:35:52 2016 +0200

----------------------------------------------------------------------
 .../cxf/binding/soap/saaj/SAAJStreamWriter.java       |  4 ++++
 .../apache/cxf/binding/soap/saaj/ParseBodyTest.java   | 14 ++++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a1e4b880/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
index 14b5c2e..d29276c 100644
--- a/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
+++ b/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJStreamWriter.java
@@ -52,6 +52,9 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter {
             if (namespace != null 
                 && namespace.equals(part.getEnvelope().getElementName().getURI()))
{
                 adjustPrefix((SOAPElement)nd2, pfx);
+                if ("Envelope".equals(nd2.getLocalName())) {
+                    adjustPrefix(part.getEnvelope().getHeader(), pfx);
+                }
             }
         } catch (SOAPException e) {
             //ignore, fallback
@@ -146,6 +149,7 @@ public final class SAAJStreamWriter extends OverlayW3CDOMStreamWriter
{
                     el = ((SOAPElement)cur).addChildElement(local, "", "");
                 } else {
                     el = ((SOAPElement)cur).addChildElement(local, pfx == null ? "" : pfx,
ns);
+                    adjustPrefix((SOAPElement)el, pfx);
                 }
                 cur.removeChild(el);
                 return el;

http://git-wip-us.apache.org/repos/asf/cxf/blob/a1e4b880/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
----------------------------------------------------------------------
diff --git a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
index bcdb6f9..1f6eeb4 100644
--- a/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
+++ b/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ParseBodyTest.java
@@ -30,6 +30,7 @@ import javax.xml.soap.SOAPMessage;
 import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 
 import org.w3c.dom.Document;
@@ -39,6 +40,7 @@ import org.apache.cxf.helpers.DOMUtils.NullResolver;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.ExchangeImpl;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.staxutils.StaxSource;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.junit.Assert;
 import org.junit.Test;
@@ -87,26 +89,30 @@ public class ParseBodyTest extends Assert {
     
     // TODO - See CXF-6900
     @Test
-    @org.junit.Ignore
     public void testReadSOAPFault() throws Exception {
         InputStream inStream = getClass().getResourceAsStream("soap12-fault.xml");
         Document doc = StaxUtils.read(inStream);
-
+        
         SoapMessage msg = new SoapMessage(new MessageImpl());
         Exchange ex = new ExchangeImpl();
         ex.setInMessage(msg);
         
         SOAPMessage saajMsg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
         SOAPPart part = saajMsg.getSOAPPart();
-        part.setContent(new DOMSource(doc));
+        SAAJStreamWriter writer = new SAAJStreamWriter(part);
+        StaxUtils.copy(doc, writer);
+        //Source s = new StaxSource(StaxUtils.createXMLStreamReader(doc));
+        //part.setContent(s);
         saajMsg.saveChanges();
-
+        
         msg.setContent(SOAPMessage.class, saajMsg);
         doc = part;
         
         // System.out.println("OUTPUT: " + StaxUtils.toString(doc));
         
         byte[] docbytes = getMessageBytes(doc);
+        
+        // System.out.println("OUTPUT: " + new String(docbytes));
         XMLStreamReader reader = StaxUtils.createXMLStreamReader(new ByteArrayInputStream(docbytes));
 
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();


Mime
View raw message