cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r773087 - in /cxf/branches/2.1.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/ rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/
Date Fri, 08 May 2009 20:28:09 GMT
Author: dkulp
Date: Fri May  8 20:28:09 2009
New Revision: 773087

URL: http://svn.apache.org/viewvc?rev=773087&view=rev
Log:
Merged revisions 773049 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r773049 | dkulp | 2009-05-08 13:09:48 -0400 (Fri, 08 May 2009) | 4 lines
  
  [CXF-2212] Fix problem of only the first detail child being written out.
  Patch from Colm O hEigeartaigh used as basis.
........

Added:
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-fault-detail.xml
      - copied unchanged from r773049, cxf/trunk/rt/bindings/soap/src/test/resources/org/apache/cxf/binding/soap/test-soap-fault-detail.xml
Modified:
    cxf/branches/2.1.x-fixes/   (props changed)
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri May  8 20:28:09 2009
@@ -1 +1 @@
-/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027
+/cxf/trunk:743446,753380,753397,753421,754585,755365,757499,757859,757899,757935,757951,758195,758303,758308,758378,758690,758910,759890,759961,759963-759964,759966,760029,760073,760150,760171,760178,760198,760212,760456,760468,760582,760938,761094,761113,761120,761317,761759,761789,762393,762518,762567,763200,763272,763495,763854,763931,763942,763953,764033-764034,764581,764599-764606,764887,765357,766013,766058,766100-766101,766763,766770,766860,766962-766963,767159,767191,767927,771416,772143,772402,772658,772714,773009-773010,773027,773049

Propchange: cxf/branches/2.1.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=773087&r1=773086&r2=773087&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Fri May  8 20:28:09 2009
@@ -25,6 +25,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.soap.AttachmentPart;
+import javax.xml.soap.Detail;
 import javax.xml.soap.MessageFactory;
 import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPException;
@@ -140,9 +141,19 @@
                 }
                 if (fault.getDetail() != null
                     && fault.getDetail().getFirstChild() != null) {
-                    soapFault.addDetail().appendChild(
-                        soapMessage.getSOAPPart().importNode(
-                            fault.getDetail().getFirstChild(), true));
+                    
+                    Detail detail = null;
+                    Node child = fault.getDetail().getFirstChild();
+                    while (child != null) {
+                        if (Node.ELEMENT_NODE == child.getNodeType()) {
+                            if (detail == null) {
+                                detail = soapFault.addDetail();
+                            }
+                            Node importedChild = soapMessage.getSOAPPart().importNode(child,
true);
+                            detail.appendChild(importedChild);
+                        }
+                        child = child.getNextSibling();
+                    }
                 }
 
                 DOMSource bodySource = new DOMSource(soapFault);

Modified: cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java?rev=773087&r1=773086&r2=773087&view=diff
==============================================================================
--- cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
(original)
+++ cxf/branches/2.1.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptorTest.java
Fri May  8 20:28:09 2009
@@ -26,9 +26,14 @@
 import java.util.List;
 
 import javax.mail.util.ByteArrayDataSource;
+import javax.xml.soap.Detail;
+import javax.xml.soap.DetailEntry;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPMessage;
 import javax.xml.stream.XMLStreamReader;
 
 import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.Soap12;
@@ -59,7 +64,6 @@
         chain.add(saajIntc);
         
         chain.add(new CheckFaultInterceptor("phase3"));
-
     }
 
     @Test
@@ -93,6 +97,42 @@
         
         assertEquals(2, headerChilds.size());
     }
+    
+    @Test
+    public void testFaultDetail() throws Exception {
+        try {
+            prepareSoapMessage("../test-soap-fault-detail.xml");
+        } catch (IOException ioe) {
+            fail("Failed in creating soap message");
+        }
+
+        staxIntc.handleMessage(soapMessage);
+        rhi.handleMessage(soapMessage);
+
+        // check the xmlReader should be placed on the first entry of the body
+        // element
+        XMLStreamReader xmlReader = soapMessage.getContent(XMLStreamReader.class);
+        xmlReader.nextTag();
+        saajIntc.handleMessage(soapMessage);
+        
+        SOAPMessage parsedMessage = soapMessage.getContent(SOAPMessage.class);
+        SOAPFault fault = parsedMessage.getSOAPBody().getFault();
+        assertEquals("soap:Server", fault.getFaultCode());
+        assertEquals("This is a fault string", fault.getFaultString());
+        Detail faultDetail = fault.getDetail();
+        NodeList faultDetailChildNodes = faultDetail.getChildNodes();
+        assertEquals(2, faultDetailChildNodes.getLength());
+        
+        Iterator<?> detailEntries = faultDetail.getDetailEntries();
+        DetailEntry detailEntry = (DetailEntry)detailEntries.next();
+        assertEquals("errorcode", detailEntry.getLocalName());
+        assertEquals(3, Integer.valueOf(detailEntry.getTextContent()).intValue());
+        detailEntry = (DetailEntry)detailEntries.next();
+        assertEquals("errorstring", detailEntry.getLocalName());
+        assertEquals("This is a fault detail error string", detailEntry.getTextContent());
+        
+    }
+    
 
     private void prepareSoapMessage(String message) throws IOException {
 



Mime
View raw message