cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r643546 - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/staxutils/ rt/core/src/main/java/org/apache/cxf/interceptor/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/ rt/frontend/jaxws/src/main/java/org/apa...
Date Tue, 01 Apr 2008 20:00:54 GMT
Author: dkulp
Date: Tue Apr  1 13:00:43 2008
New Revision: 643546

URL: http://svn.apache.org/viewvc?rev=643546&view=rev
Log:
[CXF-1491] More fixes related to pulling the fault checking stuff out of the ReadHeadersInterceptor

Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java?rev=643546&r1=643545&r2=643546&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
(original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/W3CDOMStreamReader.java
Tue Apr  1 13:00:43 2008
@@ -51,9 +51,8 @@
     public W3CDOMStreamReader(Element element) {
         super(new ElementFrame(element, null));
         newFrame(getCurrentFrame());
-
+                
         this.document = element.getOwnerDocument();
-        
     }
 
     /**
@@ -179,6 +178,9 @@
                 return frame.uris.get(index);
             }
 
+            if (frame.parent == null) {
+                return ((Element)frame.getElement()).lookupNamespaceURI(prefix);
+            }
             frame = frame.parent;
         }
 

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java?rev=643546&r1=643545&r2=643546&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/ClientFaultConverter.java
Tue Apr  1 13:00:43 2008
@@ -84,6 +84,9 @@
         FaultInfo faultWanted = null;
         MessagePartInfo part = null;
         BindingOperationInfo boi = msg.getExchange().get(BindingOperationInfo.class);
+        if (boi == null) {
+            return;
+        }
         if (boi.isUnwrapped()) {
             boi = boi.getWrappedOperation();
         }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java?rev=643546&r1=643545&r2=643546&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/HandlerChainInvoker.java
Tue Apr  1 13:00:43 2008
@@ -371,7 +371,7 @@
                 }
                 continueProcessing = false;
                 setFault(e);
-                if (responseExpected) {
+                if (responseExpected || isInbound()) {
                     //brain dead spec - if it's one way, swallow it
                     if (e instanceof SOAPFaultException) {
                         throw mapSoapFault((SOAPFaultException)e);

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java?rev=643546&r1=643545&r2=643546&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/handler/soap/SOAPHandlerInterceptor.java
Tue Apr  1 13:00:43 2008
@@ -115,7 +115,7 @@
 
             message.getInterceptorChain().add(ending);
         } else {
-            handleMessageInternal(message);
+            boolean isFault = handleMessageInternal(message);
             SOAPMessage msg = message.getContent(SOAPMessage.class);
             if (msg != null) {
                 XMLStreamReader xmlReader = createXMLStreamReaderFromSOAPMessage(msg);
@@ -127,12 +127,24 @@
                     e.printStackTrace();
                 }
             }
+            if (isFault) {
+                Endpoint ep = message.getExchange().get(Endpoint.class);
+                message.getInterceptorChain().abort();
+                if (ep.getInFaultObserver() != null) {
+                    ep.getInFaultObserver().onMessage(message);
+                    
+                }
+            }
         }
     }
 
-    private void handleMessageInternal(SoapMessage message) {
+    private boolean handleMessageInternal(SoapMessage message) {
         
         MessageContext context = createProtocolMessageContext(message);
+        if (context == null) {
+            return true;
+        }
+                
         HandlerChainInvoker invoker = getInvoker(message);
         invoker.setProtocolMessageContext(context);
 
@@ -147,6 +159,7 @@
         } else if (isOutbound(message) && isMEPComlete(message)) {
             onCompletion(message);
         }
+        return false;
     }
 
     private void handleAbort(SoapMessage message, MessageContext context) {
@@ -215,12 +228,13 @@
     @Override
     protected MessageContext createProtocolMessageContext(SoapMessage message) {
         SOAPMessageContextImpl sm = new SOAPMessageContextImpl(message);
+        
         boolean requestor = isRequestor(message);
         ContextPropertiesMapping.mapCxf2Jaxws(message.getExchange(), sm, requestor);
         Exchange exch = message.getExchange();
         setupBindingOperationInfo(exch, sm);
         SOAPMessage msg = sm.getMessage();
-        try {
+        try {            
             List<SOAPElement> params = new ArrayList<SOAPElement>();
             message.put(MessageContext.REFERENCE_PARAMETERS, params);
             SOAPHeader head = msg.getSOAPHeader();
@@ -240,6 +254,10 @@
                     }
                 }
             }
+            if (msg.getSOAPPart().getEnvelope().getBody() != null 
+                && msg.getSOAPPart().getEnvelope().getBody().hasFault()) {
+                return null;
+            }            
         } catch (SOAPException e) {
             throw new Fault(e);
         }

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java?rev=643546&r1=643545&r2=643546&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/interceptors/DispatchInDatabindingInterceptor.java
Tue Apr  1 13:00:43 2008
@@ -35,7 +35,6 @@
 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;
@@ -94,27 +93,9 @@
 
     public void handleMessage(Message message) throws Fault {
         Exchange ex = message.getExchange();     
-        /*
-        Endpoint ep = ex.get(Endpoint.class);
-        MessageInfo info = message.get(MessageInfo.class);
-        if (ep.getEndpointInfo().getBinding().getOperations().iterator().hasNext()) {
-            BindingOperationInfo bop = ep.getEndpointInfo().getBinding().getOperations().iterator().next();
-            ex.put(BindingOperationInfo.class, bop);
-            info = getMessageInfo(message, bop);
-        } 
-        */     
         
         if (isGET(message)) {
             MessageContentsList params = new MessageContentsList();
-            /*
-            if (info != null) {
-                for (MessagePartInfo i : info.getMessageParts()) {
-                    params.put(i, null);
-                }
-            } else {
-                params.add(null);
-            }
-            */
             params.add(null);
             message.setContent(List.class, params);
             LOG.info("DispatchInInterceptor skipped in HTTP GET method");
@@ -129,22 +110,19 @@
             
             if (message instanceof SoapMessage) {
                 SOAPMessage soapMessage = newSOAPMessage(is, (SoapMessage)message);
-                SOAPFault soapFault = soapMessage.getSOAPBody().getFault();
-                if (soapFault != null) {
+                if (soapMessage.getSOAPBody().hasFault()) {
                     Endpoint ep = message.getExchange().get(Endpoint.class);
                     message.getInterceptorChain().abort();
                     if (ep.getInFaultObserver() != null) {
-                        message.setContent(SOAPMessage.class, soapMessage); 
+                        message.setContent(SOAPMessage.class, soapMessage);
+                        XMLStreamReader reader = StaxUtils
+                            .createXMLStreamReader(soapMessage.getSOAPBody().getFault());
+                        reader.nextTag();
+                        message.setContent(XMLStreamReader.class, reader);
+                        
                         ep.getInFaultObserver().onMessage(message);
                         return;
                     }
-
-                    /*
-                    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();



Mime
View raw message