axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r382314 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java core/src/org/apache/axis2/engine/AxisEngine.java
Date Thu, 02 Mar 2006 07:40:30 GMT
Author: chinthaka
Date: Wed Mar  1 23:40:26 2006
New Revision: 382314

URL: http://svn.apache.org/viewcvs?rev=382314&view=rev
Log:
Adding proper faultcode with prefix

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=382314&r1=382313&r2=382314&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Wed Mar  1 23:40:26 2006
@@ -26,8 +26,6 @@
 import org.apache.axis2.i18n.Messages;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMAttribute;
-import org.apache.ws.commons.om.OMElement;
-import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAP12Constants;
 import org.apache.ws.commons.soap.SOAPFactory;
 import org.apache.ws.commons.soap.SOAPFaultReason;
@@ -44,7 +42,6 @@
 public abstract class AddressingInHandler extends AddressingHandler implements AddressingConstants
{
 
     private static final long serialVersionUID = 3907988439637261572L;
-    private OMNamespace addressingNamespaceObject;
 
     public void invoke(MessageContext msgContext) throws AxisFault {
         SOAPHeader header = msgContext.getEnvelope().getHeader();
@@ -61,7 +58,6 @@
             addressingHeaders = header.getHeaderBlocksWithNSURI(addressingNamespace);
             if (addressingHeaders != null && addressingHeaders.size() > 0) {
                 msgContext.setProperty(WS_ADDRESSING_VERSION, addressingNamespace);
-                addressingNamespaceObject = ((OMElement) addressingHeaders.get(0)).findNamespace(addressingNamespace,
null);
                 logger.debug(addressingVersion + " Headers present in the SOAP message. Starting
to process ...");
                 extractAddressingInformation(header, msgContext,
                         addressingHeaders, addressingNamespace);
@@ -125,7 +121,7 @@
                 faultInformation = new HashMap();
                 messageContext.setProperty(Constants.FAULT_INFORMATION_FOR_HEADERS, faultInformation);
             }
-            faultInformation.put(Final.FAULT_HEADER_PROB_HEADER_QNAME, addressingNamespaceObject.getPrefix()
+ ":" + addressingHeaderName);
+            faultInformation.put(Final.FAULT_HEADER_PROB_HEADER_QNAME,  "wsa:" + addressingHeaderName);
             faultInformation.put(Final.WSA_FAULT_ACTION, Final.WSA_FAULT_ACTION);
             return true;
         } else {

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=382314&r1=382313&r2=382314&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
Wed Mar  1 23:40:26 2006
@@ -32,6 +32,7 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.commons.om.OMAbstractFactory;
 import org.apache.ws.commons.om.OMElement;
+import org.apache.ws.commons.om.OMNamespace;
 import org.apache.ws.commons.soap.SOAP11Constants;
 import org.apache.ws.commons.soap.SOAP12Constants;
 import org.apache.ws.commons.soap.SOAPConstants;
@@ -277,10 +278,10 @@
         } else if (soapException != null) {
             soapFaultCode = soapException.getFaultCode();
         } else
-        if (e != null && ((exception = e) instanceof AxisFault || (exception = e.getCause())
instanceof AxisFault))
+        if (((exception = e) instanceof AxisFault || (exception = e.getCause()) instanceof
AxisFault))
         {
             QName faultCodeQName = ((AxisFault) exception).getFaultCode();
-            if (faultCodeQName != null) {
+            if (faultCodeQName != null && faultCodeQName.getLocalPart().indexOf(":")
== -1) {
                 String prefix = faultCodeQName.getPrefix();
                 String uri = faultCodeQName.getNamespaceURI();
                 prefix = prefix == null || "".equals(prefix) ? Constants.AXIS2_NAMESPACE_PREFIX
: prefix;
@@ -292,7 +293,7 @@
 
         // defaulting to fault code Sender, if no message is available
         soapFaultCode = ("".equals(soapFaultCode) || (soapFaultCode == null))
-                ? getSenderFaultCode(soapNamespaceURI)
+                ? getSenderFaultCode(context.getEnvelope().getNamespace())
                 : soapFaultCode;
         fault.getCode().getValue().setText(soapFaultCode);
 
@@ -529,9 +530,9 @@
         }
     }
 
-    private String getSenderFaultCode(String soapNamespace) {
-        return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespace)
-                ? SOAP12Constants.FAULT_CODE_SENDER
-                : SOAP11Constants.FAULT_CODE_SENDER;
+    private String getSenderFaultCode(OMNamespace soapNamespace) {
+        return SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(soapNamespace.getName())
+                ? soapNamespace.getPrefix() + ":" + SOAP12Constants.FAULT_CODE_SENDER
+                : soapNamespace.getPrefix() + ":" + SOAP11Constants.FAULT_CODE_SENDER;
     }
 }



Mime
View raw message