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 am...@apache.org on 2007/11/09 07:29:47 UTC

svn commit: r593427 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Author: amilas
Date: Thu Nov  8 22:29:47 2007
New Revision: 593427

URL: http://svn.apache.org/viewvc?rev=593427&view=rev
Log:
add the proper error messages for wsdl faults

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=593427&r1=593426&r2=593427&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Thu Nov  8 22:29:47 2007
@@ -252,7 +252,7 @@
 
     /**
      * Sets the URI to the base document associated with the WSDL definition.
-     * This identifies the origin of the Definition and allows the 
+     * This identifies the origin of the Definition and allows the
      * Definition to be reloaded.  Note that this is the URI of the base
      * document, not the imports.
      *
@@ -267,7 +267,7 @@
 
     /**
      * Gets the URI to the base document associated with the WSDL definition.
-     * This identifies the origin of the Definition and allows the 
+     * This identifies the origin of the Definition and allows the
      * Definition to be reloaded.  Note that this is the URI of the base
      * document, not the imports.
      *
@@ -280,7 +280,7 @@
 
 
     /**
-     * Populates a given service. 
+     * Populates a given service.
      *
      * @throws AxisFault
      */
@@ -288,7 +288,7 @@
         try {
             setup();
 
-            // NOTE: set the axisService with the Parameter for the WSDL 
+            // NOTE: set the axisService with the Parameter for the WSDL
             // Definition after the rest of the work
 
             if (wsdl4jDefinition == null) {
@@ -339,9 +339,9 @@
             axisService.getPolicyInclude().setPolicyRegistry(registry);
 
 
-            // Setting wsdl4jdefintion to the axisService parameter include list, 
-            // so if someone needs to use the definition directly, 
-            // he can do that by getting the parameter 
+            // Setting wsdl4jdefintion to the axisService parameter include list,
+            // so if someone needs to use the definition directly,
+            // he can do that by getting the parameter
             Parameter wsdlDefinitionParameter = new Parameter();
             wsdlDefinitionParameter.setName(WSDLConstants.WSDL_4_J_DEFINITION);
 
@@ -689,22 +689,33 @@
                  bindingFaults.hasNext();) {
 
                 BindingFault bindingFault = (BindingFault) bindingFaults.next();
-                Fault wsdl4jFault = wsdl4jOperation.getFault(bindingFault.getName());
-                Message wsdl4jFaultMessge = wsdl4jFault.getMessage();
-
-                AxisMessage faultMessage = findFaultMessage(
-                        wsdl4jFaultMessge.getQName().getLocalPart(),
-                        axisOperation.getFaultMessages());
-
-                AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage();
-                addDocumentation(axisBindingFaultMessage, wsdl4jFaultMessge.getDocumentationElement());
-                axisBindingFaultMessage.setFault(true);
-                axisBindingFaultMessage.setAxisMessage(faultMessage);
-                axisBindingFaultMessage.setParent(axisBindingOperation);
+                if (bindingFault.getName() == null) {
+                    throw new AxisFault("Binding name is null for the binding fault in " +
+                            " binding operation ==> " + wsdl4jBindingOperation.getName());
+                } else {
+                    Fault wsdl4jFault = wsdl4jOperation.getFault(bindingFault.getName());
+                    if (wsdl4jFault == null){
+                        throw new AxisFault("Can not find the corresponding fault element in " +
+                                "wsdl operation " + wsdl4jOperation.getName() + " for the fault" +
+                                " name " + bindingFault.getName());
+                    } else {
+                        Message wsdl4jFaultMessge = wsdl4jFault.getMessage();
 
-                axisBindingOperation.addFault(axisBindingFaultMessage);
-                if (isSetMessageQNames) {
-                    addQNameReference(faultMessage, wsdl4jFault.getMessage());
+                        AxisMessage faultMessage = findFaultMessage(
+                                wsdl4jFaultMessge.getQName().getLocalPart(),
+                                axisOperation.getFaultMessages());
+
+                        AxisBindingMessage axisBindingFaultMessage = new AxisBindingMessage();
+                        addDocumentation(axisBindingFaultMessage, wsdl4jFaultMessge.getDocumentationElement());
+                        axisBindingFaultMessage.setFault(true);
+                        axisBindingFaultMessage.setAxisMessage(faultMessage);
+                        axisBindingFaultMessage.setParent(axisBindingOperation);
+
+                        axisBindingOperation.addFault(axisBindingFaultMessage);
+                        if (isSetMessageQNames) {
+                            addQNameReference(faultMessage, wsdl4jFault.getMessage());
+                        }
+                    }
                 }
             }
 
@@ -744,7 +755,7 @@
         setPolicyRegistryFromService(axisService);
 
         setupComplete = true; // if any part of setup fails, don't mark
-        // setupComplete        
+        // setupComplete
     }
 
 
@@ -2684,11 +2695,11 @@
     }
 
 //    private void processPoliciesInDefinition() {
-//        
+//
 //        Object obj;
 //        for (Iterator iterator = wsdl4jDefinition.getExtensibilityElements().iterator(); iterator.hasNext();) {
 //            obj = iterator.next();
-//            
+//
 //            if (obj instanceof UnknownExtensibilityElement) {
 //                Element e = ((UnknownExtensibilityElement) obj).getElement();
 //                if (WSDLConstants.WSDL11Constants.POLICY.getNamespaceURI().equals(e.getNamespaceURI()) &&



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