You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by he...@apache.org on 2005/07/27 14:02:09 UTC

svn commit: r225494 - in /webservices/axis/trunk/java/modules: core/src/org/apache/axis2/clientapi/InOutMEPClient.java xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java

Author: hemapani
Date: Wed Jul 27 05:01:55 2005
New Revision: 225494

URL: http://svn.apache.org/viewcvs?rev=225494&view=rev
Log:
fix the http://issues.apache.org/jira/browse/AXIS2-98

Modified:
    webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
    webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java

Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=225494&r1=225493&r2=225494&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java Wed Jul 27 05:01:55 2005
@@ -17,13 +17,10 @@
  */
 package org.apache.axis2.clientapi;
 
-import java.io.IOException;
-import java.util.Iterator;
-
 import javax.xml.namespace.QName;
 
-import org.apache.axis2.Constants;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -35,12 +32,9 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.i18n.Messages;
-import org.apache.axis2.om.OMElement;
 import org.apache.axis2.om.OMException;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFault;
-import org.apache.axis2.soap.SOAPFaultDetail;
-import org.apache.axis2.soap.impl.llom.SOAPConstants;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.util.threadpool.AxisWorker;
 import org.apache.wsdl.WSDLConstants;
@@ -188,20 +182,14 @@
             SOAPEnvelope resenvelope = response.getEnvelope();
             if (resenvelope.getBody().hasFault()) {
                 SOAPFault soapFault = resenvelope.getBody().getFault();
-                SOAPFaultDetail faultDetail = soapFault.getDetail();
-                //if there is exception throw it
-                if(faultDetail != null){
-                    Iterator it = faultDetail.getAllDetailEntries();
-                    while(it.hasNext()){
-                        OMElement detailElement = (OMElement)it.next();
-                        if(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY.equals(detailElement.getLocalName())){
-                            throw new AxisFault(soapFault.getException());
-                        }
-                    }
+                Exception ex = soapFault.getException();
+                //does the SOAPFault has a detail element for Excpetion
+                if(ex != null){
+                    throw new AxisFault(ex);
+                }else{
+                    //if detail element not present let us throw the exception with Reason
+                    throw new AxisFault(soapFault.getReason().getText());
                 }
-                //throw new exception with reason
-                throw new AxisFault(soapFault.getReason().getText());
-                
             }
             return response;
         }

Modified: webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java?rev=225494&r1=225493&r2=225494&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java (original)
+++ webservices/axis/trunk/java/modules/xml/src/org/apache/axis2/soap/impl/llom/SOAPFaultImpl.java Wed Jul 27 05:01:55 2005
@@ -117,14 +117,13 @@
                 SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME);
     }
 
-
-    // ---------------------------------------------------------------------------------------------//
-
+    /**
+     * If exception detailElement is not there we will return null
+     */
     public Exception getException() throws OMException {
-        getDetail();
-        if (getDetail() == null) {
-            return new Exception(
-                    "No Exception element found in the SOAP Detail element");
+        SOAPFaultDetail detail = getDetail();
+        if (detail == null) {
+            return null;
         }
 
         OMElement exceptionElement = getDetail().getFirstChildWithName(
@@ -132,8 +131,7 @@
         if (exceptionElement != null) {
             return new Exception(exceptionElement.getText());
         }
-        return new Exception(
-                "No Exception element found in the SOAP Detail element");
+        return null;
     }
 
     protected void putExceptionToSOAPFault(Exception e) throws SOAPProcessingException {