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 2009/08/26 07:09:27 UTC

svn commit: r807879 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java

Author: amilas
Date: Wed Aug 26 05:09:26 2009
New Revision: 807879

URL: http://svn.apache.org/viewvc?rev=807879&view=rev
Log:
support REST type fault responses received for soap messages.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java?rev=807879&r1=807878&r2=807879&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/Utils.java Wed Aug 26 05:09:26 2009
@@ -27,6 +27,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.transport.TransportListener;
+import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.MessageContext;
@@ -439,6 +440,18 @@
                 if (messageContext.isDoingREST() && soapBody.getFirstElement() != null) {
                     return new AxisFault(soapBody.getFirstElement().toString());
                 }
+
+                // if axis2 receives an rest type fault for an soap message then message context
+                // has not been set to isDoingREST() but in this case we can detect it by using
+                // the message type. so if the message type is application/xml we assum it as an rest call
+                if ((messageContext.getProperty(Constants.Configuration.MESSAGE_TYPE) != null) &&
+                        messageContext.getProperty(Constants.Configuration.MESSAGE_TYPE).equals(HTTPConstants.MEDIA_TYPE_APPLICATION_XML)){
+                     if (soapBody.getFirstElement() != null){
+                         return new AxisFault(soapBody.getFirstElement().toString());
+                     } else {
+                         return new AxisFault("application/xml type error received.");
+                     }
+                }
             }
             // Not going to be able to
             throw new IllegalArgumentException(