You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2008/04/05 15:46:31 UTC

svn commit: r645101 - in /webservices/axis2/trunk/java/modules: jaxws/src/org/apache/axis2/jaxws/server/dispatcher/ metadata/src/org/apache/axis2/jaxws/description/impl/

Author: dims
Date: Sat Apr  5 06:46:30 2008
New Revision: 645101

URL: http://svn.apache.org/viewvc?rev=645101&view=rev
Log:
Fix for AXIS2-3706 - Methods with multiple faults and wsa actions are not handled correctly

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java?rev=645101&r1=645100&r2=645101&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaBeanDispatcher.java Sat Apr  5 06:46:30 2008
@@ -357,6 +357,8 @@
         
         response.setCausedByException(axisFault);
         
+        setFaultResponseAction(t, request, response);
+        
         return response;
     }
     

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java?rev=645101&r1=645100&r2=645101&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/dispatcher/JavaDispatcher.java Sat Apr  5 06:46:30 2008
@@ -19,8 +19,10 @@
 
 package org.apache.axis2.jaxws.server.dispatcher;
 
+import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.server.EndpointCallback;
 import org.apache.axis2.jaxws.server.EndpointInvocationContext;
 import org.apache.axis2.jaxws.server.InvocationHelper;
@@ -235,4 +237,15 @@
         }
     }
 
+    protected static void setFaultResponseAction(Throwable exception, 
+                                                 MessageContext request,
+                                                 MessageContext response) {
+         AxisOperation operation = request.getOperationDescription().getAxisOperation();
+         if (operation != null) {
+             exception = ClassUtils.getRootCause(exception);        
+             String action = operation.getFaultAction(exception.getClass().getName());
+             response.getAxisMessageContext().setWSAAction(action);
+         }
+    }
+    
 }

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java?rev=645101&r1=645100&r2=645101&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/impl/OperationDescriptionImpl.java Sat Apr  5 06:46:30 2008
@@ -363,40 +363,7 @@
         
         newAxisOperation.setOutputAction(outputAction);
 
-        //Set the FAULT ACTION
-        // Walk the fault information
-        FaultDescription[] faultDescs = getFaultDescriptions();
-        
-        if (faultDescs != null) {
-            for (FaultDescription faultDesc : faultDescs) {
-        
-                AxisMessage faultMessage = new AxisMessage();
-                String faultName = faultDesc.getName();
-                faultMessage.setName(faultName);
-                
-                String faultAction = 
-                        WSDL11ActionHelper.getFaultActionFromStringInformation( targetNS, 
-                                        portTypeName, 
-                                        operationName, 
-                                        faultMessage.getName());
-                
-                newAxisOperation.addFaultAction(faultMessage.getName(), faultAction);
-                newAxisOperation.setFaultMessages(faultMessage);
-            }
-        }
-        
-        //Override the actions based on any FaultAction annotations that are defined.
-        FaultAction[] faultActions = getFaultActions();
-        
-        if (faultActions != null) {
-            for (FaultAction faultAction : faultActions) {
-                String className = faultAction.className().getName();
-                FaultDescription faultDesc = resolveFaultByExceptionName(className);
-                if (faultDesc != null)  {
-                    newAxisOperation.addFaultAction(faultDesc.getName(), faultAction.value());
-                }
-            }
-        }
+        setFaultActions(newAxisOperation, operationName, targetNS, portTypeName);
 
         getEndpointInterfaceDescriptionImpl().getEndpointDescriptionImpl().
             getAxisService().addOperation(newAxisOperation);
@@ -483,40 +450,7 @@
         newAxisOperation.setOutputAction(outputAction);
         
         //Set the FAULT ACTION
-        // Walk the fault information
-        FaultDescription[] faultDescs = getFaultDescriptions();
-        
-        //Generate fault actions according to the Default Action Pattern.
-        if (faultDescs != null) {
-            for (FaultDescription faultDesc : faultDescs) {
-        
-                AxisMessage faultMessage = new AxisMessage();
-                String faultName = faultDesc.getName();
-                faultMessage.setName(faultName);
-                
-                String faultAction = 
-                        WSDL11ActionHelper.getFaultActionFromStringInformation( targetNS, 
-                                        portTypeName, 
-                                        operationName, 
-                                        faultMessage.getName());
-                
-                newAxisOperation.addFaultAction(faultMessage.getName(), faultAction);
-                newAxisOperation.setFaultMessages(faultMessage);
-            }
-        }
-        
-        //Override the fault actions based on any FaultAction annotations that are defined.
-        FaultAction[] faultActions = getFaultActions();
-        
-        if (faultActions != null) {
-            for (FaultAction faultAction : faultActions) {
-                String className = faultAction.className().getName();
-                FaultDescription faultDesc = resolveFaultByExceptionName(className);
-                if (faultDesc != null)  {
-                    newAxisOperation.addFaultAction(faultDesc.getName(), faultAction.value());
-                }
-            }
-        }
+        setFaultActions(newAxisOperation, operationName, targetNS, portTypeName);
 
         // If this is a DOC/LIT/BARE operation, then set the QName of the input AxisMessage to the 
         // part for the first IN or IN/OUT non-header parameter.  If there are no parameters, then don't set
@@ -565,6 +499,46 @@
             }
         }
         return newAxisOperation;
+    }
+
+    private void setFaultActions(AxisOperation newAxisOperation,
+                                 String operationName,
+                                 String targetNS,
+                                 String portTypeName) {
+        // Walk the fault information
+        FaultDescription[] faultDescs = getFaultDescriptions();
+        
+        //Generate fault actions according to the Default Action Pattern.
+        if (faultDescs != null) {
+            for (FaultDescription faultDesc : faultDescs) {
+        
+                AxisMessage faultMessage = new AxisMessage();
+                String faultName = faultDesc.getName();
+                faultMessage.setName(faultName);
+                
+                String faultAction = 
+                        WSDL11ActionHelper.getFaultActionFromStringInformation( targetNS, 
+                                        portTypeName, 
+                                        operationName, 
+                                        faultMessage.getName());
+                
+                newAxisOperation.addFaultAction(faultDesc.getExceptionClassName(),  faultAction);
+                newAxisOperation.setFaultMessages(faultMessage);
+            }
+        }
+        
+        //Override the fault actions based on any FaultAction annotations that are defined.
+        FaultAction[] faultActions = getFaultActions();
+        
+        if (faultActions != null) {
+            for (FaultAction faultAction : faultActions) {
+                String className = faultAction.className().getName();
+                FaultDescription faultDesc = resolveFaultByExceptionName(className);
+                if (faultDesc != null)  {
+                    newAxisOperation.addFaultAction(className, faultAction.value());
+                }
+            }
+        }
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org