You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2011/08/17 21:55:55 UTC

svn commit: r1158883 - in /axis/axis2/java/core/branches/1_6: ./ modules/distribution/ modules/kernel/src/org/apache/axis2/description/ modules/kernel/test-resources/wsdl/ modules/kernel/test/org/apache/axis2/description/ modules/samples/faulthandling/...

Author: veithen
Date: Wed Aug 17 19:55:54 2011
New Revision: 1158883

URL: http://svn.apache.org/viewvc?rev=1158883&view=rev
Log:
AXIS2-4533 / AXIS2-5034: Merged r1157211 and r1157265 to the 1.6 branch.

Added:
    axis/axis2/java/core/branches/1_6/modules/kernel/test-resources/wsdl/faults.wsdl
      - copied unchanged from r1157211, axis/axis2/java/core/trunk/modules/kernel/test-resources/wsdl/faults.wsdl
    axis/axis2/java/core/branches/1_6/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
      - copied unchanged from r1157211, axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/description/WSDL11ToAxisServiceBuilderTest.java
Modified:
    axis/axis2/java/core/branches/1_6/   (props changed)
    axis/axis2/java/core/branches/1_6/modules/distribution/pom.xml
    axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/client/src/example/BankClient.java
    axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/service/src/example/BankServiceSkeleton.java

Propchange: axis/axis2/java/core/branches/1_6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 17 19:55:54 2011
@@ -1 +1 @@
-/axis/axis2/java/core/trunk:1068985,1069659,1069898,1070439,1072077,1072271,1072296,1072499,1072510,1075057,1078242,1081563,1081587,1081590,1082316,1082322,1082600,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083425,1083433,1083446,1084753,1085157,1085173,1085514,1085889,1085927,1085931,1087073,1088239,1088248-1088249,1088251,1088268,1088730,1088904,1089225,1089989,1090429,1090457,1091178,1091191,1094117,1096530,1096557,1099385,1099389,1100628,1101037,1103013,1103336,1103606,1103760,1128580,1128584,1128618,1128645,1130590,1131425,1134438,1134616,1136156,1136159,1136177,1137153,1137159,1138144,1138203,1139448,1139484,1156305,1156382,1157373,1157415,1157424,1157501,1157517,1157522,1157535
+/axis/axis2/java/core/trunk:1068985,1069659,1069898,1070439,1072077,1072271,1072296,1072499,1072510,1075057,1078242,1081563,1081587,1081590,1082316,1082322,1082600,1082702,1082726,1082738,1083180,1083192,1083379,1083381,1083425,1083433,1083446,1084753,1085157,1085173,1085514,1085889,1085927,1085931,1087073,1088239,1088248-1088249,1088251,1088268,1088730,1088904,1089225,1089989,1090429,1090457,1091178,1091191,1094117,1096530,1096557,1099385,1099389,1100628,1101037,1103013,1103336,1103606,1103760,1128580,1128584,1128618,1128645,1130590,1131425,1134438,1134616,1136156,1136159,1136177,1137153,1137159,1138144,1138203,1139448,1139484,1156305,1156382,1157211,1157265,1157373,1157415,1157424,1157501,1157517,1157522,1157535

Modified: axis/axis2/java/core/branches/1_6/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/distribution/pom.xml?rev=1158883&r1=1158882&r2=1158883&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/distribution/pom.xml (original)
+++ axis/axis2/java/core/branches/1_6/modules/distribution/pom.xml Wed Aug 17 19:55:54 2011
@@ -352,6 +352,9 @@
                                 <!-- Test of the mtom sample -->
                                 <ant dir="${project.build.directory}/axis2-${project.version}/samples/mtom" target="generate.service" />
                                 <ant dir="${project.build.directory}/axis2-${project.version}/samples/mtom" target="generate.client" />
+                                
+                                <!-- Test of the faulthandling sample -->
+                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/faulthandling" target="generate.service"/>
                             </tasks>
                         </configuration>
                     </execution>

Modified: axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=1158883&r1=1158882&r2=1158883&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Wed Aug 17 19:55:54 2011
@@ -115,6 +115,15 @@ public class WSDL11ToAxisServiceBuilder 
     public static final int COMPONENT_MESSAGE = 2;
     public static final int COMPONENT_BINDING = 3;
 
+    /**
+     * Parameter used on {@link AxisMessage} objects to track the value of the <tt>name</tt>
+     * attribute of the <tt>wsdl:fault</tt>. Note that this is more like a workaround. The problem
+     * is that {@link AxisMessage} stores the faults as a simple list. A better fix would be to
+     * replace that by a map with the fault name as key, similar to what WSDL4J does (see
+     * {@link Operation#getFaults()}).
+     */
+    private static final String FAULT_NAME = "faultName";
+    
     protected static final Log log = LogFactory
             .getLog(WSDL11ToAxisServiceBuilder.class);
     private static final boolean isTraceEnabled = log.isTraceEnabled();
@@ -1182,7 +1191,7 @@ public class WSDL11ToAxisServiceBuilder 
         AxisMessage tempMessage;
         for (int i = 0; i < faultMessages.size(); i++) {
             tempMessage = (AxisMessage) faultMessages.get(i);
-            if (name.equals(tempMessage.getName())) {
+            if (name.equals(tempMessage.getParameterValue(FAULT_NAME))) {
                 return tempMessage;
             }
 
@@ -1550,10 +1559,11 @@ public class WSDL11ToAxisServiceBuilder 
             Fault fault = (Fault) faults.get(faultKeyIterator.next());
             AxisMessage axisFaultMessage = new AxisMessage();
             addDocumentation(axisFaultMessage,fault.getDocumentationElement());
+            axisFaultMessage.addParameter(FAULT_NAME, fault.getName());
             Message faultMessage = fault.getMessage();
             if (null != faultMessage) {
                 axisFaultMessage
-                        .setName(fault.getName());
+                        .setName(faultMessage.getQName().getLocalPart());
 
                 copyExtensibleElements(faultMessage.getExtensibilityElements(),
                                        dif, axisFaultMessage, PORT_TYPE_OPERATION_FAULT);

Modified: axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/client/src/example/BankClient.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/client/src/example/BankClient.java?rev=1158883&r1=1158882&r2=1158883&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/client/src/example/BankClient.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/client/src/example/BankClient.java Wed Aug 17 19:55:54 2011
@@ -51,10 +51,10 @@ public final class BankClient {
             final WithdrawResponse withdrawResponse = bankService.withdraw(withdrawRequest);
             System.out.println("Balance = " + withdrawResponse.getBalance());
             
-        } catch (AccountNotExistException e) {
+        } catch (AccountNotExistFaultMessage e) {
             final AccountNotExistFault fault = e.getFaultMessage();
             System.out.println("Account#" + fault.getAccount() + " does not exist");
-        } catch (InsufficientFundException e) {
+        } catch (InsufficientFundFaultMessage e) {
             final InsufficientFundFault fault = e.getFaultMessage();
             System.out.println("Account#" + fault.getAccount() + " has balance of " + fault.getBalance() + ". It cannot support withdrawal of " + fault.getRequestedFund());
         } catch (RemoteException e) {

Modified: axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/service/src/example/BankServiceSkeleton.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/service/src/example/BankServiceSkeleton.java?rev=1158883&r1=1158882&r2=1158883&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/service/src/example/BankServiceSkeleton.java (original)
+++ axis/axis2/java/core/branches/1_6/modules/samples/faulthandling/service/src/example/BankServiceSkeleton.java Wed Aug 17 19:55:54 2011
@@ -35,12 +35,12 @@
 
          */
         public  example.WithdrawResponse withdraw(example.Withdraw param0)
-           throws InsufficientFundException,AccountNotExistException{
+           throws InsufficientFundFaultMessage,AccountNotExistFaultMessage{
                 final String account = param0.getAccount();
         if (account.equals("13")) {
             final AccountNotExistFault fault = new AccountNotExistFault();
             fault.setAccount(account);
-            AccountNotExistException messageException = new AccountNotExistException("Account does not exist!");
+            AccountNotExistFaultMessage messageException = new AccountNotExistFaultMessage("Account does not exist!");
             messageException.setFaultMessage(fault);
             throw messageException;
         }
@@ -51,7 +51,7 @@
             fault.setAccount(account);
             fault.setBalance(1000);
             fault.setRequestedFund(amount);
-            InsufficientFundException messageException = new InsufficientFundException("Insufficient funds");
+            InsufficientFundFaultMessage messageException = new InsufficientFundFaultMessage("Insufficient funds");
             messageException.setFaultMessage(fault);
             throw messageException;
         }