ws-axis-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r823318 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: marshaller/impl/alt/MethodMarshallerUtils.java message/XMLFault.java
Date Thu, 08 Oct 2009 20:49:03 GMT
Author: scheu
Date: Thu Oct  8 20:49:03 2009
New Revision: 823318

URL: http://svn.apache.org/viewvc?rev=823318&view=rev
Log:
AXIS2-4523
Contributor: Rich Scheuerle
This is a small change to the JAX-WS exception unmarshalling code.
The JAX-WS engine uses the first element of the Fault detail to find and unmarshal a service
exception (aka application exception).  The code is chagned to use the first element even
if there are more than one element inside the fault detail.
Extra debug information is also added.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLFault.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java?rev=823318&r1=823317&r2=823318&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/marshaller/impl/alt/MethodMarshallerUtils.java
Thu Oct  8 20:49:03 2009
@@ -1167,8 +1167,25 @@
 
         // If there is only one block, get the element name of that block.
         QName elementQName = null;
-        if (detailBlocks != null && detailBlocks.length == 1) {
+        if (detailBlocks != null && detailBlocks.length >= 1) {
             elementQName = detailBlocks[0].getQName();
+            if (log.isDebugEnabled()) {
+                if (detailBlocks.length > 1) {
+                    log.debug("The detail element has multiple child elements.  " +
+                            "Only the first child is examined to determine if this is a service
exception.  " + 
+                            "If this first detail child is mapped to a service exception,
" + 
+                            "the information in other detail children may be ignored.  "
+ 
+                            "The most common scenario is that the second child is a " +
+                            "{http://jax-ws.dev.java.net/}exception element, which is used
" +
+                            "by some vendors for debugging. ");
+                }
+            }
+        }
+        
+        if (log.isDebugEnabled()) {
+            log.debug("element QName which will be used to find a service exception = " +
elementQName);
+            log.debug("XMLFault Dump = " +xmlfault.dump(""));
+            log.debug("OperationDesc Dump =" + operationDesc);
         }
 
         // Use the element name to find the matching FaultDescriptor

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLFault.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLFault.java?rev=823318&r1=823317&r2=823318&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLFault.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/message/XMLFault.java
Thu Oct  8 20:49:03 2009
@@ -21,6 +21,9 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 
 /**
  * This is a value class that is an agnostic representation of a fault. The XMLFault can
be added to
@@ -33,6 +36,8 @@
  */
 public class XMLFault {
 
+    private static Log log = LogFactory.getLog(XMLFault.class);
+    
     // Here is a sample comprehensive SOAP 1.2 fault which will help you understand the
     // structure of XMLFault.
     // <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
@@ -102,6 +107,9 @@
         this.code = code;
         this.reason = reason;
         this.detailBlocks = detailBlocks;
+        if (log.isDebugEnabled()) {
+            log.debug("Created XMLFault:" + this.dump(""));
+        }
     }
 
 
@@ -181,5 +189,35 @@
         this.subCodes = subCodes;
     }
 
+    /**
+     * dump contents, used for debugging
+     * @return String containing contents of XMLFault
+     */
+    public String dump(String indent) {
+        String text = "";
+        final String NL = "\n";
+        try {
+            text += indent + "XMLFault " + this + NL;
+            text += indent + " code=   " + code.toQName("") + NL;
+            if (reason != null) {
+                text += indent + " reason= " + reason.getText() + NL;
+            } else {
+                text += indent + " reason= null" + NL;
+            }
+            text += indent + " role   =" + role + NL;
+            text += indent + " node   =" + node + NL;
+            if (detailBlocks == null) {
+                text += indent + " no detail blocks" + NL;
+            } else {
+                for (int i=0; i<detailBlocks.length; i++) {
+                    text += indent + " detail= " + detailBlocks[i].getQName();
+                }
+            }
+            
+        } catch (Exception e) {
+            text += "Could not dump the XMLFault due to exception " + e;
+        }
+        return text;
+    }
 }
 



Mime
View raw message