You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2008/01/02 23:05:26 UTC

svn commit: r608251 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/core/src/main/java/org/apache/cxf/attachment/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/

Author: dkulp
Date: Wed Jan  2 14:05:25 2008
New Revision: 608251

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

........
  r606756 | mmao | 2007-12-25 01:04:21 -0500 (Tue, 25 Dec 2007) | 7 lines
  
  CXF-1330 
    * SOAPAction working in dispatch mode
  CXF-1331
    * Dispatch raise SOAPFaultException if recieved a soap fault message
........

Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java?rev=608251&r1=608250&r2=608251&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentDeserializer.java Wed Jan  2 14:05:25 2008
@@ -285,7 +285,6 @@
 
         final String ct = headers.getHeader("Content-Type", null);
         DataSource source = new AttachmentDataSource(ct, new DelegatingInputStream(partStream));
-        //DataSource source = new AttachmentDataSource(null, new DelegatingInputStream(partStream));
         att.setDataHandler(new DataHandler(source));
 
         for (Enumeration<?> e = headers.getAllHeaders(); e.hasMoreElements();) {

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?rev=608251&r1=608250&r2=608251&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java Wed Jan  2 14:05:25 2008
@@ -56,6 +56,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.soap.SoapBinding;
+import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.ConduitSelector;
@@ -177,26 +178,29 @@
             // execute chain
             chain.doIntercept(message);
             
-                    
-            if (message.getContent(Exception.class) != null) {
+            Exception exp = message.getContent(Exception.class);
+            if (exp == null && exchange.getInMessage() != null) {
+                exp = exchange.getInMessage().getContent(Exception.class);
+            }
+
+            if (exp != null) {
                 getConduitSelector().complete(exchange);
                 if (getBinding() instanceof SOAPBinding) {
                     try {
                         SOAPFault soapFault = SOAPFactory.newInstance().createFault();
-                        Fault fault = (Fault)message.getContent(Exception.class);
+                        Fault fault = (Fault)exp;
                         soapFault.setFaultCode(fault.getFaultCode());
                         soapFault.setFaultString(fault.getMessage());
-                        SOAPFaultException exception = new SOAPFaultException(soapFault);
-                        throw exception;
+                        throw new SOAPFaultException(soapFault);
                     } catch (SOAPException e) {
                         throw new WebServiceException(e);
                     }
                 } else if (getBinding() instanceof HTTPBinding) {
                     HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
-                    exception.initCause(message.getContent(Exception.class));
+                    exception.initCause(exp);
                     throw exception;
                 } else {
-                    throw new WebServiceException(message.getContent(Exception.class));
+                    throw new WebServiceException(exp);
                 }
             }
     
@@ -272,8 +276,12 @@
                 // TODO: what for non soap bindings?
             }       
             chain.add(new DispatchLogicalHandlerInterceptor(jaxwsBinding));
-        }   
-        
+        }
+
+        if (getBinding() instanceof SOAPBinding) {
+            chain.add(new SoapActionOutInterceptor());
+        }
+
         chain.add(new MessageSenderInterceptor());
 
         chain.add(new DispatchOutDatabindingInterceptor(mode));
@@ -309,7 +317,7 @@
             DispatchLogicalHandlerInterceptor slhi 
                 = new DispatchLogicalHandlerInterceptor(jaxwsBinding, Phase.USER_LOGICAL);            
             chain.add(slhi);
-        }           
+        }
 
         List<Interceptor> inInterceptors = new ArrayList<Interceptor>();
         inInterceptors.add(new DispatchInDatabindingInterceptor(cl, mode));

Modified: incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java?rev=608251&r1=608250&r2=608251&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java Wed Jan  2 14:05:25 2008
@@ -35,6 +35,7 @@
 import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPConstants;
 import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFault;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.transform.Source;
@@ -121,6 +122,14 @@
             
             if (message instanceof SoapMessage) {
                 SOAPMessage soapMessage = newSOAPMessage(is, (SoapMessage)message);
+                SOAPFault soapFault = soapMessage.getSOAPBody().getFault();
+                if (soapFault != null) {
+                    Fault fault = new Fault(new org.apache.cxf.common.i18n.Message(soapFault.getFaultString(),
+                                                                                   LOG));
+                    fault.setFaultCode(soapFault.getFaultCodeAsQName());
+                    message.setContent(Exception.class, fault);
+                }                
+                
                 PostDispatchSOAPHandlerInterceptor postSoap = new PostDispatchSOAPHandlerInterceptor();
                 message.getInterceptorChain().add(postSoap);
                 
@@ -257,7 +266,7 @@
             addAfter(DispatchLogicalHandlerInterceptor.class.getName());            
         }
 
-        public void handleMessage(Message message) throws Fault {
+        public void handleMessage(Message message) throws Fault {            
             Object obj = null;
 
             //Convert Source to object