cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1304550 - in /cxf/branches/2.4.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/
Date Fri, 23 Mar 2012 18:32:32 GMT
Author: dkulp
Date: Fri Mar 23 18:32:32 2012
New Revision: 1304550

URL: http://svn.apache.org/viewvc?rev=1304550&view=rev
Log:
Merged revisions 1304548 via  svn merge from
https://svn.apache.org/repos/asf/cxf/branches/2.5.x-fixes

........
  r1304548 | dkulp | 2012-03-23 14:31:41 -0400 (Fri, 23 Mar 2012) | 9 lines
  
  Merged revisions 1304535 via  svn merge from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1304535 | dkulp | 2012-03-23 14:10:40 -0400 (Fri, 23 Mar 2012) | 1 line
    
    [CXF-4181] Fix fault qname namespace handling
  ........
  
........

Added:
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml
      - copied unchanged from r1304548, cxf/branches/2.5.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml
Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java

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

Modified: cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java?rev=1304550&r1=1304549&r2=1304550&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultInInterceptor.java
Fri Mar 23 18:32:32 2012
@@ -27,7 +27,6 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.xpath.XPathConstants;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -71,9 +70,23 @@ public class Soap12FaultInInterceptor ex
         Map<String, String> ns = new HashMap<String, String>();
         ns.put("s", Soap12.SOAP_NAMESPACE);
         XPathUtils xu = new XPathUtils(ns);        
-        
         try {
-            Document fault = StaxUtils.read(new FragmentStreamReader(reader));
+            Node mainNode = message.getContent(Node.class);
+            
+            Node fault = null;
+            if (mainNode != null) {
+                Node bodyNode = (Node) xu.getValue("//s:Body",
+                                                   mainNode,
+                                                   XPathConstants.NODE);
+
+                StaxUtils.readDocElements(bodyNode.getOwnerDocument(),
+                                          bodyNode,
+                                          new FragmentStreamReader(reader),
+                                          false, false);
+                fault = (Element)xu.getValue("//s:Fault", bodyNode, XPathConstants.NODE);
+            } else {
+                fault = StaxUtils.read(new FragmentStreamReader(reader));
+            }
             Element el = (Element)xu.getValue("//s:Fault/s:Code/s:Value", 
                                       fault, 
                                       XPathConstants.NODE);

Modified: cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java?rev=1304550&r1=1304549&r2=1304550&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
Fri Mar 23 18:32:32 2012
@@ -178,4 +178,27 @@ public class SoapFaultSerializerTest ext
         assertEquals(Soap12.getInstance().getReceiver(), fault2.getFaultCode());
     }
 
+    @Test
+    public void testCXF4181() throws Exception {
+
+        SoapMessage m = new SoapMessage(new MessageImpl());
+        m.setVersion(Soap12.getInstance());        
+
+
+        XMLStreamReader reader = StaxUtils.createXMLStreamReader(this.getClass()
+                                                                 .getResourceAsStream("cxf4181.xml"));
+
+        m.setContent(XMLStreamReader.class, reader);
+
+        new ReadHeadersInterceptor(null).handleMessage(m);
+        Soap12FaultInInterceptor inInterceptor = new Soap12FaultInInterceptor();
+        inInterceptor.handleMessage(m);
+
+        SoapFault fault2 = (SoapFault)m.getContent(Exception.class);
+        assertNotNull(fault2);
+        
+        assertEquals(Soap12.getInstance().getSender(), fault2.getFaultCode());
+        assertEquals(new QName("http://schemas.xmlsoap.org/ws/2005/02/trust", "FailedAuthentication"),

+                     fault2.getSubCode());
+    }
 }



Mime
View raw message