cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1307053 - in /cxf/branches/2.4.x-fixes: ./ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/ rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/...
Date Thu, 29 Mar 2012 18:57:38 GMT
Author: dkulp
Date: Thu Mar 29 18:57:37 2012
New Revision: 1307053

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

........
  r1307045 | dkulp | 2012-03-29 14:50:48 -0400 (Thu, 29 Mar 2012) | 10 lines
  
  Merged revisions 1307039 via  git cherry-pick from
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1307039 | dkulp | 2012-03-29 14:41:12 -0400 (Thu, 29 Mar 2012) | 3 lines
  
    [CXF-4181] More work with getting the fault details "correct" along with
    fixing some prefix issues with SAAJ implementations.
  
  ........
........

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/ReadHeadersInterceptor.java
    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/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/SoapFaultSerializerTest.java
    cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml

Propchange: cxf/branches/2.4.x-fixes/
            ('svn:mergeinfo' removed)

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/ReadHeadersInterceptor.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/ReadHeadersInterceptor.java?rev=1307053&r1=1307052&r2=1307053&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/ReadHeadersInterceptor.java
Thu Mar 29 18:57:37 2012
@@ -193,7 +193,7 @@ public class ReadHeadersInterceptor exte
                             }
                         }
                         
-                        HeaderProcessor p = bus.getExtension(HeaderManager.class)
+                        HeaderProcessor p = bus == null ? null : bus.getExtension(HeaderManager.class)
                             .getHeaderProcessor(hel.getNamespaceURI());
 
                         Object obj;

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=1307053&r1=1307052&r2=1307053&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
Thu Mar 29 18:57:37 2012
@@ -41,6 +41,7 @@ import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.staxutils.FragmentStreamReader;
 import org.apache.cxf.staxutils.StaxUtils;
+import org.apache.cxf.staxutils.W3CDOMStreamReader;
 
 public class Soap12FaultInInterceptor extends AbstractSoapInterceptor {
     
@@ -72,9 +73,13 @@ public class Soap12FaultInInterceptor ex
         XPathUtils xu = new XPathUtils(ns);        
         try {
             Node mainNode = message.getContent(Node.class);
-            
             Node fault = null;
-            if (mainNode != null) {
+            
+            if (reader instanceof W3CDOMStreamReader) {
+                W3CDOMStreamReader dr = (W3CDOMStreamReader)reader;
+                fault = dr.getCurrentElement();
+                dr.consumeFrame();
+            } else if (mainNode != null) {
                 Node bodyNode = (Node) xu.getValue("//s:Body",
                                                    mainNode,
                                                    XPathConstants.NODE);

Modified: cxf/branches/2.4.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.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java?rev=1307053&r1=1307052&r2=1307053&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/saaj/SAAJInInterceptor.java
Thu Mar 29 18:57:37 2012
@@ -286,7 +286,7 @@ public class SAAJInInterceptor extends A
         }
         Element elem = DOMUtils.getFirstElement(header);
         while (elem != null) {
-            Bus b = message.getExchange().get(Bus.class);
+            Bus b = message.getExchange() == null ? null : message.getExchange().get(Bus.class);
             HeaderProcessor p =  null;
             if (b != null && b.getExtension(HeaderManager.class) != null) {
                 p = b.getExtension(HeaderManager.class).getHeaderProcessor(elem.getNamespaceURI());

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=1307053&r1=1307052&r2=1307053&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
Thu Mar 29 18:57:37 2012
@@ -23,10 +23,14 @@ import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 
 import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPFault;
+import javax.xml.soap.SOAPPart;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.Soap12;
@@ -34,6 +38,8 @@ import org.apache.cxf.binding.soap.SoapF
 import org.apache.cxf.binding.soap.SoapMessage;
 import org.apache.cxf.binding.soap.interceptor.Soap11FaultOutInterceptor.Soap11FaultOutInterceptorInternal;
 import org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor.Soap12FaultOutInterceptorInternal;
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor.SAAJPreInInterceptor;
 import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.ExchangeImpl;
@@ -180,25 +186,69 @@ public class SoapFaultSerializerTest ext
 
     @Test
     public void testCXF4181() throws Exception {
-
+        //Try WITH SAAJ
         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 SAAJPreInInterceptor().handleMessage(m);
         new ReadHeadersInterceptor(null).handleMessage(m);
-        Soap12FaultInInterceptor inInterceptor = new Soap12FaultInInterceptor();
-        inInterceptor.handleMessage(m);
-
+        new StartBodyInterceptor().handleMessage(m);
+        new SAAJInInterceptor().handleMessage(m);
+        new Soap12FaultInInterceptor().handleMessage(m);
+
+        Node nd = m.getContent(Node.class);
+        
+        SOAPPart part = (SOAPPart)nd;
+        assertEquals("S", part.getEnvelope().getPrefix());
+        assertEquals("S2", part.getEnvelope().getHeader().getPrefix());
+        assertEquals("S3", part.getEnvelope().getBody().getPrefix());
+        SOAPFault fault = part.getEnvelope().getBody().getFault();
+        assertEquals("S", fault.getPrefix());
+        
+        assertEquals("Authentication Failure", fault.getFaultString());
+        
         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());
+        
+        Element el = part.getEnvelope().getBody();
+        nd = el.getFirstChild();
+        int count = 0;
+        while (nd != null) {
+            if (nd instanceof Element) {
+                count++;
+            }
+            nd = nd.getNextSibling();
+        }
+        assertEquals(1, count);
+        
+        
+        //Try WITHOUT SAAJ
+        m = new SoapMessage(new MessageImpl());
+        m.setVersion(Soap12.getInstance());  
+        reader = StaxUtils.createXMLStreamReader(this.getClass()
+                                                 .getResourceAsStream("cxf4181.xml"));
+
+        m.setContent(XMLStreamReader.class, reader);
+
+        new ReadHeadersInterceptor(null).handleMessage(m);
+        new StartBodyInterceptor().handleMessage(m);
+        new Soap12FaultInInterceptor().handleMessage(m);
+
+        nd = m.getContent(Node.class);
+
+        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());
     }
 }

Modified: cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml?rev=1307053&r1=1307052&r2=1307053&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml
(original)
+++ cxf/branches/2.4.x-fixes/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/interceptor/cxf4181.xml
Thu Mar 29 18:57:37 2012
@@ -2,7 +2,10 @@
             xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"

             xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"

             xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
-  <S:Body>
+  <S2:Header xmlns:S2="http://www.w3.org/2003/05/soap-envelope">
+     <foo:blah xmlns:foo="http://cxf.apache.org/test">Snarf</foo:blah>
+  </S2:Header>
+  <S3:Body xmlns:S3="http://www.w3.org/2003/05/soap-envelope">
     <S:Fault>
       <S:Code>
         <S:Value>S:Sender</S:Value>
@@ -14,5 +17,5 @@
         <S:Text xml:lang="en-US">Authentication Failure</S:Text>
       </S:Reason>
     </S:Fault>
-  </S:Body>
+  </S3:Body>
 </S:Envelope>



Mime
View raw message