axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r523160 - in /webservices/axis2/trunk/java: etc/ modules/addressing/src/org/apache/axis2/handlers/addressing/ modules/addressing/test/org/apache/axis2/handlers/addressing/ modules/integration/test/org/apache/axis2/addressing/ modules/kernel...
Date Wed, 28 Mar 2007 04:20:04 GMT
Author: gdaniels
Date: Tue Mar 27 21:19:56 2007
New Revision: 523160

URL: http://svn.apache.org/viewvc?view=rev&rev=523160
Log:
* Switch to SNAPSHOT Axiom for the time being to deal with recent changes

* Clean up code in AddressingInFaultHandler, improve tests.

* Namespace qualify some addressing Constants

* Various improvements to AxisFault - keep sub-elements around in fields instead of a Map, keep list of subcodes, etc.

* Fix a few SAAJ bugs.  Utilize OM's natural abilities with QName text values instead of hacking our own version (which did some terribly wrong things like setting the namespace of the <Value> element itself), improve logic for getting subcodes, etc.

* Don't swallow exceptions in SAAJ tests - bubble them up.

Modified:
    webservices/axis2/trunk/java/etc/project.properties
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java
    webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingFinalServiceTest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/AxisFault.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
    webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java
    webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java

Modified: webservices/axis2/trunk/java/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/etc/project.properties?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/etc/project.properties (original)
+++ webservices/axis2/trunk/java/etc/project.properties Tue Mar 27 21:19:56 2007
@@ -100,7 +100,8 @@
 activation.version=1.1
 annogen.version=0.1.0
 ant.version=1.6.5
-axiom.version=1.2.3-RC1
+#axiom.version=1.2.3-RC1
+axiom.version=SNAPSHOT
 backport_util_concurrent.version=2.2
 bcel.version=5.2
 bcprov.version=jdk13-133

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java Tue Mar 27 21:19:56 2007
@@ -22,6 +22,9 @@
 import org.apache.axiom.soap.SOAPFaultReason;
 import org.apache.axiom.soap.SOAPFaultText;
 import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPFaultDetail;
+import org.apache.axiom.soap.SOAPFaultCode;
+import org.apache.axiom.soap.SOAPFaultSubCode;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
@@ -29,7 +32,7 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.AbstractHandler;
 
-import javax.xml.namespace.QName;
+import java.util.Iterator;
 
 /**
  * This class is used to extract WS-Addressing Spec defined Faults and FaultDetail and convert them
@@ -43,94 +46,72 @@
         if (Final.WSA_FAULT_ACTION.equals(action)
                 || Final.WSA_SOAP_FAULT_ACTION.equals(action)
                 || Submission.WSA_FAULT_ACTION.equals(action)) {
-            String faultLocalName = getFaultLocalName(msgContext);
-            String faultDetailString = getWSAFaultDetailString(msgContext);
+            SOAPEnvelope envelope = msgContext.getEnvelope();
+            SOAPFault fault = envelope.getBody().getFault();
 
-            if (faultLocalName != null) {
-                String newReason = AddressingFaultsHelper
-                        .getMessageForAxisFault(faultLocalName, faultDetailString);
-
-                if (newReason != null) {
-                    SOAPEnvelope envelope = msgContext.getEnvelope();
-                    SOAPFault fault = envelope.getBody().getFault();
-
-                    SOAPFactory sf = ((SOAPFactory) envelope.getOMFactory());
-                    SOAPFaultReason sfr = sf.createSOAPFaultReason();
-                    if (envelope.getNamespace().getNamespaceURI()
-                            .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                        sfr.setText(newReason);
-                    } else {
-                        SOAPFaultText sft = sf.createSOAPFaultText();
-                        sft.setText(newReason);
-                        sfr.addSOAPText(sft);
-                    }
-                    if (fault != null) {
-                        // else call the on error method with the fault
-                        AxisFault axisFault = new AxisFault(fault.getCode(), sfr,
-                                                            fault.getNode(), fault.getRole(),
-                                                            fault.getDetail());
-                        msgContext.setProperty(Constants.INBOUND_FAULT_OVERRIDE, axisFault);
-                    }
-                }
+            if (fault == null) {
+                throw new AxisFault("Problem");
             }
-        }
 
-        return InvocationResponse.CONTINUE;
-    }
+            SOAPFactory sf = ((SOAPFactory) envelope.getOMFactory());
+            SOAPFaultDetail detail = null;
 
-    private String getFaultLocalName(MessageContext msgContext) {
-        SOAPEnvelope envelope = msgContext.getEnvelope();
-        SOAPFault fault = envelope.getBody().getFault();
-        QName faultCodeQName = null;
-        String result = null;
-        if (fault != null) {
-            if (envelope.getNamespace().getNamespaceURI()
-                    .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                faultCodeQName = fault.getCode().getTextAsQName();
+            if (msgContext.isSOAP11()) {
+                SOAPHeader header = envelope.getHeader();
+                OMElement element = header.getFirstChildWithName(Final.QNAME_WSA_HEADER_DETAIL);
+                if (element != null) {
+                    detail = sf.createSOAPFaultDetail(fault);
+                    Iterator i = element.getChildElements();
+                    while (i.hasNext()) {
+                        OMElement detailElement = (OMElement)i.next();
+                        detail.addDetailEntry(detailElement);
+                    }
+                }
             } else {
-                faultCodeQName = fault.getCode().getValue().getTextAsQName();
+                detail = fault.getDetail();
             }
-            if (fault.getCode().getSubCode() != null) {
-                faultCodeQName = fault.getCode().getSubCode().getValue().getTextAsQName();
-                if (fault.getCode().getSubCode().getSubCode() != null) {
-                    faultCodeQName =
-                            fault.getCode().getSubCode().getSubCode().getValue().getTextAsQName();
+
+            String faultDetailString = null;
+            if (detail != null) {
+                OMElement element = detail.getFirstElement();
+                if (element != null) {
+                    faultDetailString = element.getText();
                 }
             }
-        }
-        if (faultCodeQName != null) {
-            result = faultCodeQName.getLocalPart();
-        }
-        return result;
-    }
 
-    private String getWSAFaultDetailString(MessageContext msgContext) {
-        SOAPEnvelope envelope = msgContext.getEnvelope();
-        OMElement faultDetailElement = null;
-        String result = null;
-
-        if (msgContext.isSOAP11()) {
-            SOAPHeader header = envelope.getHeader();
-            faultDetailElement = header.getFirstChildWithName(new QName(Final.FAULT_HEADER_DETAIL));
-            if (faultDetailElement != null) {
-                result = faultDetailElement.getFirstElement().getText();
-            }
-        } else {
-            SOAPFault fault = envelope.getBody().getFault();
-            if (fault != null) {
-                if (fault.getDetail() != null) {
-                    faultDetailElement = fault.getDetail()
-                            .getFirstChildWithName(new QName(Final.FAULT_PROBLEM_ACTION_NAME));
-                    if (faultDetailElement == null) {
-                        faultDetailElement = fault.getDetail().getFirstChildWithName(
-                                new QName(Final.FAULT_HEADER_PROB_HEADER_QNAME));
-                    }
+            String faultLocalName;
+            SOAPFaultCode code = fault.getCode();
+            SOAPFaultSubCode subCode = code.getSubCode();
+            if (subCode == null) {
+                faultLocalName = code.getTextAsQName().getLocalPart();
+            } else {
+                while (subCode.getSubCode() != null) {
+                    subCode = subCode.getSubCode();
                 }
+                faultLocalName = subCode.getValue().getTextAsQName().getLocalPart();
             }
-            if (faultDetailElement != null) {
-                result = faultDetailElement.getText();
+
+            String newReason = AddressingFaultsHelper
+                    .getMessageForAxisFault(faultLocalName, faultDetailString);
+
+            if (newReason != null) {
+                SOAPFaultReason sfr = sf.createSOAPFaultReason();
+                if (envelope.getNamespace().getNamespaceURI()
+                        .equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
+                    sfr.setText(newReason);
+                } else {
+                    SOAPFaultText sft = sf.createSOAPFaultText();
+                    sft.setText(newReason);
+                    sfr.addSOAPText(sft);
+                }
+                // else call the on error method with the fault
+                AxisFault axisFault = new AxisFault(fault.getCode(), sfr,
+                                                    fault.getNode(), fault.getRole(),
+                                                    detail);
+                msgContext.setProperty(Constants.INBOUND_FAULT_OVERRIDE, axisFault);
             }
         }
-        return result;
+
+        return InvocationResponse.CONTINUE;
     }
 }

Modified: webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/test/org/apache/axis2/handlers/addressing/AddressingInFaultHandlerTest.java Tue Mar 27 21:19:56 2007
@@ -16,12 +16,19 @@
 
 import junit.framework.TestCase;
 import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
+import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
+import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.handlers.util.TestUtil;
 
+import javax.xml.namespace.QName;
+import java.util.List;
+
 public class AddressingInFaultHandlerTest extends TestCase {
 
     TestUtil testUtil = new TestUtil();
@@ -34,9 +41,14 @@
     public void testInvalidAddressingHeaderWsaToSOAP11() throws Exception {
         AxisFault af = getFaultForTest("InvalidAddressingHeader", true);
         assertNotNull(af);
-        assertEquals("The server failed to process the WS-Addressing header: " + "wsa:To" +
-                " [Reason]: A header representing a Message Addressing Property is not valid and the message cannot be processed",
-                     af.getMessage());
+        assertEquals("Wrong fault code!",
+                     AddressingConstants.Final.QNAME_INVALID_HEADER,
+                     af.getFaultCode());
+        OMElement probHeaderDetail = af.getFaultDetailElement().getFirstChildWithName(
+                AddressingConstants.Final.QNAME_PROBLEM_HEADER);
+        assertNotNull(probHeaderDetail);
+        assertEquals(AddressingConstants.Final.QNAME_WSA_TO,
+                     probHeaderDetail.getTextAsQName());
     }
 
     public void testMissingActionSOAP11() throws Exception {
@@ -47,9 +59,14 @@
     public void testInvalidAddressingHeaderWsaToSOAP12() throws Exception {
         AxisFault af = getFaultForTest("InvalidAddressingHeader", false);
         assertNotNull(af);
-        assertEquals("The server failed to process the WS-Addressing header: " + "wsa:To" +
-                " [Reason]: A header representing a Message Addressing Property is not valid and the message cannot be processed",
-                     af.getMessage());
+        assertEquals("Wrong fault code", SOAP12Constants.QNAME_SENDER_FAULTCODE, af.getFaultCode());
+        List subCodes = af.getFaultSubCodes();
+        assertNotNull(subCodes);
+        assertEquals(1, subCodes.size());
+        assertEquals("Wrong fault subcode",
+                     new QName(AddressingConstants.Final.WSA_NAMESPACE,
+                               AddressingConstants.Final.FAULT_INVALID_HEADER),
+                     subCodes.get(0));
     }
 
     public void testMissingActionSOAP12() throws Exception {

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingFinalServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingFinalServiceTest.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingFinalServiceTest.java (original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/addressing/AddressingFinalServiceTest.java Tue Mar 27 21:19:56 2007
@@ -101,6 +101,30 @@
         return service;
     }
 
+    private ServiceClient createServiceClient() throws AxisFault {
+        AxisService service =
+                createSimpleOneWayServiceforClient(serviceName,
+                        Echo.class.getName(),
+                        operationName);
+
+        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
+
+        ServiceClient sender;
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
+        options.setAction(operationName.getLocalPart());
+        options.setReplyTo(replyTo);
+        options.setFaultTo(faultTo);
+
+        sender = new ServiceClient(configcontext, service);
+        sender.setOptions(options);
+        sender.engageModule("addressing");
+
+        return sender;
+    }
+
     protected void tearDown() throws Exception {
         UtilServer.unDeployService(serviceName);
         UtilServer.unDeployService(new QName("RedirectReceiverService"));
@@ -125,6 +149,61 @@
         return service;
     }
 
+    private OMElement createEchoOMElement(String text) {
+        OMFactory fac = OMAbstractFactory.getOMFactory();
+
+        OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
+        OMElement method = fac.createOMElement("echoOMElement", omNs);
+        OMElement value = fac.createOMElement("myValue", omNs);
+        value.setText(text);
+        method.addChild(value);
+
+        return method;
+    }
+
+    private ServiceClient createNoAddressingServiceClient() throws AxisFault {
+        AxisService service =
+                Utils.createSimpleServiceforClient(serviceName,
+                        Echo.class.getName(),
+                        operationName);
+
+        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
+        ServiceClient sender;
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setAction(operationName.getLocalPart());
+        options.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+        options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean.TRUE);
+
+        sender = new ServiceClient(configcontext, service);
+        sender.setOptions(options);
+
+        return sender;
+    }
+
+    private ServiceClient createSyncResponseServiceClient() throws AxisFault {
+        AxisService service =
+                Utils.createSimpleServiceforClient(serviceName,
+                        Echo.class.getName(),
+                        operationName);
+
+        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
+        ServiceClient sender;
+
+        Options options = new Options();
+        options.setTo(targetEPR);
+        options.setAction(operationName.getLocalPart());
+
+        sender = new ServiceClient(configcontext, service);
+        sender.setOptions(options);
+        sender.engageModule("addressing");
+
+        return sender;
+    }
+
+    // Tests
+
     public void testEchoToReplyTo() throws Exception {
         OMElement method = createEchoOMElement("this message should not cause a fault.");
         ServiceClient sender = null;
@@ -132,10 +211,10 @@
         try {
             sender = createServiceClient();
             sender.fireAndForget(operationName, method);
-            System.out.println("send the reqest");
+            System.out.println("sent the request");
             int index = 0;
             while (!RedirectReceiver.hasReceivedResponse()) {
-                Thread.sleep(100);
+                Thread.sleep(1000);
                 index++;
                 if (index > 45) {
                     throw new AxisFault(
@@ -155,10 +234,10 @@
         try {
             sender = createServiceClient();
             sender.fireAndForget(operationName, method);
-            System.out.println("send the reqest");
+            System.out.println("sent the request");
             int index = 0;
             while (!RedirectReceiver.hasReceivedFault()) {
-                Thread.sleep(100);
+                Thread.sleep(1000);
                 index++;
                 if (index > 45) {
                     throw new AxisFault(
@@ -171,42 +250,6 @@
         }
     }
 
-    private OMElement createEchoOMElement(String text) {
-        OMFactory fac = OMAbstractFactory.getOMFactory();
-
-        OMNamespace omNs = fac.createOMNamespace("http://localhost/my", "my");
-        OMElement method = fac.createOMElement("echoOMElement", omNs);
-        OMElement value = fac.createOMElement("myValue", omNs);
-        value.setText(text);
-        method.addChild(value);
-
-        return method;
-    }
-
-    private ServiceClient createServiceClient() throws AxisFault {
-        AxisService service =
-                createSimpleOneWayServiceforClient(serviceName,
-                        Echo.class.getName(),
-                        operationName);
-
-        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
-
-        ServiceClient sender;
-
-        Options options = new Options();
-        options.setTo(targetEPR);
-        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
-        options.setAction(operationName.getLocalPart());
-        options.setReplyTo(replyTo);
-        options.setFaultTo(faultTo);
-
-        sender = new ServiceClient(configcontext, service);
-        sender.setOptions(options);
-        sender.engageModule("addressing");
-
-        return sender;
-    }
-
     public void testUsingAddressingRequired() throws Exception {
         echoService.setWSAddressingFlag("required");
 
@@ -226,47 +269,6 @@
             if (sender != null)
                 sender.cleanup();
         }
-    }
-
-    private ServiceClient createNoAddressingServiceClient() throws AxisFault {
-        AxisService service =
-                Utils.createSimpleServiceforClient(serviceName,
-                        Echo.class.getName(),
-                        operationName);
-
-        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
-        ServiceClient sender;
-
-        Options options = new Options();
-        options.setTo(targetEPR);
-        options.setAction(operationName.getLocalPart());
-        options.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
-        options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Boolean.TRUE);
-
-        sender = new ServiceClient(configcontext, service);
-        sender.setOptions(options);
-
-        return sender;
-    }
-
-    private ServiceClient createSyncResponseServiceClient() throws AxisFault {
-        AxisService service =
-                Utils.createSimpleServiceforClient(serviceName,
-                        Echo.class.getName(),
-                        operationName);
-
-        ConfigurationContext configcontext = UtilServer.createClientConfigurationContext();
-        ServiceClient sender;
-
-        Options options = new Options();
-        options.setTo(targetEPR);
-        options.setAction(operationName.getLocalPart());
-
-        sender = new ServiceClient(configcontext, service);
-        sender.setOptions(options);
-        sender.engageModule("addressing");
-
-        return sender;
     }
 
     public void testSyncResponseAddressing() throws Exception {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/AxisFault.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/AxisFault.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/AxisFault.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/AxisFault.java Tue Mar 27 21:19:56 2007
@@ -19,7 +19,6 @@
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.soap.SOAP12Constants;
-import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axiom.soap.SOAPFault;
 import org.apache.axiom.soap.SOAPFaultCode;
 import org.apache.axiom.soap.SOAPFaultDetail;
@@ -27,6 +26,7 @@
 import org.apache.axiom.soap.SOAPFaultReason;
 import org.apache.axiom.soap.SOAPFaultRole;
 import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axiom.soap.SOAPFaultSubCode;
 import org.apache.axis2.context.MessageContext;
 
 import javax.xml.namespace.QName;
@@ -35,10 +35,8 @@
 import java.lang.reflect.InvocationTargetException;
 import java.rmi.RemoteException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Map;
 
 /**
  * An exception which maps cleanly to a SOAP fault.
@@ -78,16 +76,20 @@
      */
     private List headers = new ArrayList(0);
 
+    private String message;
+
     private List faultReasonList = new ArrayList(1);
     private QName faultCode;
+    private List faultSubCodes;
     private String faultNode;
     private String faultRole;
     private OMElement detail;
 
-    private Map faultElements;
-
-    private String message;
-    private Throwable cause;
+    private SOAPFaultCode soapFaultCode;
+    private SOAPFaultReason soapFaultReason;
+    private SOAPFaultNode soapFaultNode;
+    private SOAPFaultRole soapFaultRole;
+    private SOAPFaultDetail soapFaultDetail;
 
     /**
      * If not null, the messageContext represents the fault as it
@@ -116,7 +118,7 @@
      * @param message
      */
     public AxisFault(String message) {
-        super(message);
+        this.message = message;
         addReason(message);
     }
 
@@ -178,52 +180,44 @@
                                   SOAPFaultNode soapFaultNode,
                                   SOAPFaultRole soapFaultRole,
                                   SOAPFaultDetail soapFaultDetail) {
-        if (faultElements == null) {
-            // assuming that most of the times fault code, fault string and fault details are set
-            faultElements = new HashMap(3);
-        }
-        setToElementsListIfNotNull(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, soapFaultCode);
-        setToElementsListIfNotNull(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME, soapFaultReason);
-        setToElementsListIfNotNull(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME, soapFaultNode);
-        setToElementsListIfNotNull(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME, soapFaultRole);
-        setToElementsListIfNotNull(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, soapFaultDetail);
-
-        if (soapFaultReason != null) {
-            if(soapFaultReason.getNamespace() != null && 
-                    soapFaultReason.getNamespace().getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
-                message = soapFaultReason.getFirstSOAPText().getText();
-            } else {
-                message = soapFaultReason.getText();
-            }
-        }
+        this.soapFaultCode = soapFaultCode;
+        this.soapFaultReason = soapFaultReason;
+        this.soapFaultNode = soapFaultNode;
+        this.soapFaultRole = soapFaultRole;
+        this.soapFaultDetail = soapFaultDetail;
 
         if (soapFaultDetail != null) {
-            OMElement exceptionElement = soapFaultDetail.getFirstChildWithName(
-                    new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
-            if (exceptionElement != null && exceptionElement.getText() != null) {
-                cause = new Exception(exceptionElement.getText());
-            }
+//            OMElement exceptionElement = soapFaultDetail.getFirstChildWithName(
+//                    new QName(SOAPConstants.SOAP_FAULT_DETAIL_EXCEPTION_ENTRY));
+//            if (exceptionElement != null && exceptionElement.getText() != null) {
+//                cause = new Exception(exceptionElement.getText());
+//            }
 
             // setting the first child element of the fault detail as this.detail
             this.detail = soapFaultDetail.getFirstElement();
 
         }
 
-        if (soapFaultCode != null && soapFaultCode.getValue() != null) {
+        if (soapFaultReason != null) {
+            message = soapFaultReason.getText();
+        }
+
+        if (soapFaultCode != null) {
             if(soapFaultReason.getNamespace() != null && 
                     soapFaultReason.getNamespace().getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
                 faultCode = soapFaultCode.getValue().getTextAsQName();
             } else {
                 faultCode = soapFaultCode.getTextAsQName();
             }
-            
-        }
-    }
 
-    private void setToElementsListIfNotNull(String soapFaultElementName,
-                                            OMElement soapFaultElement) {
-        if (soapFaultElement != null) {
-            faultElements.put(soapFaultElementName, soapFaultElement);
+            SOAPFaultSubCode subCode = soapFaultCode.getSubCode();
+            if (subCode != null) {
+                if (faultSubCodes == null) faultSubCodes = new ArrayList();
+                while (subCode != null) {
+                    faultSubCodes.add(subCode.getValue().getTextAsQName());
+                    subCode = subCode.getSubCode();
+                }
+            }
         }
     }
 
@@ -266,6 +260,7 @@
 
         if (message != null) {
             addReason(message);
+            this.message = message;
         }
     }
 
@@ -297,7 +292,7 @@
      * @param faultMessageContext
      */
     public AxisFault(String message, MessageContext faultMessageContext) {
-        super(message);
+        this(message);
         this.faultMessageContext = faultMessageContext;
     }
 
@@ -399,13 +394,16 @@
         return faultCode;
     }
 
+    public List getFaultSubCodes() {
+        return faultSubCodes;
+    }
+
     /**
      * @return SOAPFaultCode if, user has set a {@link SOAPFaultCode} element when constructing the
      *         {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault}
      */
     public SOAPFaultCode getFaultCodeElement() {
-        return (SOAPFaultCode) (faultElements != null ?
-                faultElements.get(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME) : null);
+        return soapFaultCode;
     }
 
     /**
@@ -413,8 +411,7 @@
      *         {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault}
      */
     public SOAPFaultReason getFaultReasonElement() {
-        return (SOAPFaultReason) (faultElements != null ?
-                faultElements.get(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME) : null);
+        return soapFaultReason;
     }
 
     /**
@@ -422,8 +419,7 @@
      *         {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault}
      */
     public SOAPFaultNode getFaultNodeElement() {
-        return (SOAPFaultNode) (faultElements != null ?
-                faultElements.get(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME) : null);
+        return soapFaultNode;
     }
 
     /**
@@ -431,8 +427,7 @@
      *         {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault}
      */
     public SOAPFaultRole getFaultRoleElement() {
-        return (SOAPFaultRole) (faultElements != null ?
-                faultElements.get(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME) : null);
+        return soapFaultRole;
     }
 
     /**
@@ -440,8 +435,7 @@
      *         {@link #AxisFault(org.apache.axiom.soap.SOAPFaultCode, org.apache.axiom.soap.SOAPFaultReason, org.apache.axiom.soap.SOAPFaultNode, org.apache.axiom.soap.SOAPFaultRole, org.apache.axiom.soap.SOAPFaultDetail) AxisFault}
      */
     public SOAPFaultDetail getFaultDetailElement() {
-        return (SOAPFaultDetail) (faultElements != null ?
-                faultElements.get(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME) : null);
+        return soapFaultDetail;
     }
 
     /**
@@ -480,11 +474,6 @@
         this.nodeURI = nodeURI;
     }
 
-
-    public Map getFaultElements() {
-        return faultElements;
-    }
-
     public String getFaultNode() {
         return faultNode;
     }
@@ -493,14 +482,6 @@
         return faultRole;
     }
 
-    public String getMessage() {
-        return message != null ? message : super.getMessage();
-    }
-
-    public Throwable getCause() {
-        return cause != null ? cause : super.getCause();
-    }
-
     /**
      * Returns the MessageContext representation of the fault if the fault
      * was created by providing that.
@@ -573,4 +554,13 @@
 	public void setFaultAction(String faultAction) {
 		this.faultAction = faultAction;
 	}
+
+    /**
+     * Returns the detail message, including the message from the cause, if any, of this exception.
+     *
+     * @return the detail message
+     */
+    public String getMessage() {
+        return message;
+    }
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/addressing/AddressingConstants.java Tue Mar 27 21:19:56 2007
@@ -171,6 +171,9 @@
         final QName QNAME_WSA_REPLY_TO = new QName(WSA_NAMESPACE, WSA_REPLY_TO);
         final QName QNAME_WSA_RELATES_TO = new QName(WSA_NAMESPACE, WSA_RELATES_TO);
         final QName QNAME_WSA_MESSAGE_ID = new QName(WSA_NAMESPACE, WSA_MESSAGE_ID);
+        final QName QNAME_WSA_HEADER_DETAIL = new QName(WSA_NAMESPACE, FAULT_HEADER_DETAIL);
+        final QName QNAME_PROBLEM_HEADER = new QName(WSA_NAMESPACE, FAULT_HEADER_PROB_HEADER_QNAME);
+        final QName QNAME_INVALID_HEADER = new QName(WSA_NAMESPACE, FAULT_INVALID_HEADER);
     }
 
 

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java Tue Mar 27 21:19:56 2007
@@ -371,6 +371,9 @@
         HttpServletResponse response =
                 (HttpServletResponse) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE);
         if (response != null) {
+
+            //TODO : Check for SOAP 1.2!
+            
             SOAPFaultCode code = faultContext.getEnvelope().getBody().getFault().getCode();
             OMElement valueElement = null;
             if (code != null) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/CommonsHTTPTransportSender.java Tue Mar 27 21:19:56 2007
@@ -169,7 +169,7 @@
                 }
 
                 if (value != null && JavaUtils.isTrueExplicitly(value)) {
-                    if (msgContext.isSOAP11() != true) {
+                    if (!msgContext.isSOAP11()) {
                         msgContext.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,
                                                Boolean.TRUE);
                     }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/server/AxisHttpService.java Tue Mar 27 21:19:56 2007
@@ -166,6 +166,7 @@
                 if (AddressingHelper.isFaultRedirected(this.msgContext)) {
                     response.setStatusLine(new BasicStatusLine(ver, 202, "Accepted"));
                 } else {
+                    // TODO: Why isn't this a SOAP fault?
                     response.setStatusLine(new BasicStatusLine(ver, 500, "Internal server error"));
                     String msg = ex.getMessage();
                     StringEntity entity;

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java Tue Mar 27 21:19:56 2007
@@ -27,9 +27,7 @@
 import org.apache.axiom.soap.SOAPFault;
 import org.apache.axiom.soap.SOAPFaultCode;
 import org.apache.axiom.soap.SOAPFaultDetail;
-import org.apache.axiom.soap.SOAPFaultNode;
 import org.apache.axiom.soap.SOAPFaultReason;
-import org.apache.axiom.soap.SOAPFaultRole;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axiom.soap.SOAPHeaderBlock;
 import org.apache.axiom.soap.SOAPProcessingException;
@@ -59,7 +57,6 @@
 import java.net.URISyntaxException;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 public class MessageContextBuilder {
 
@@ -179,7 +176,8 @@
             newmsgCtx.setWSAAction(inMessageContext.getWSAAction());
         }
 
-        newmsgCtx.setAxisMessage(ao.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
+        if (ao != null)
+            newmsgCtx.setAxisMessage(ao.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE));
 
         newmsgCtx.setDoingMTOM(inMessageContext.isDoingMTOM());
         newmsgCtx.setServiceGroupContextId(inMessageContext.getServiceGroupContextId());
@@ -442,12 +440,8 @@
         } else if (soapException != null) {
             soapFaultCode = soapException.getFaultCode();
         } else if (axisFault != null) {
-
-            Map faultElementsMap = axisFault.getFaultElements();
-            if (faultElementsMap != null &&
-                    faultElementsMap.get(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME) != null) {
-                fault.setCode((SOAPFaultCode) faultElementsMap
-                        .get(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME));
+            if (axisFault.getFaultCodeElement() != null) {
+                fault.setCode(axisFault.getFaultCodeElement());
             } else {
                 QName faultCodeQName = axisFault.getFaultCode();
                 if (faultCodeQName != null) {
@@ -492,11 +486,8 @@
         } else if (soapException != null) {
             message = soapException.getMessage();
         } else if (axisFault != null) {
-            Map faultElementsMap = axisFault.getFaultElements();
-            if (faultElementsMap != null &&
-                    faultElementsMap.get(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME) != null) {
-                fault.setReason((SOAPFaultReason) faultElementsMap
-                        .get(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME));
+            if (axisFault.getFaultReasonElement() != null) {
+                fault.setReason(axisFault.getFaultReasonElement());
             } else {
                 message = axisFault.getReason();
                 if (message == null || "".equals(message)) {
@@ -523,11 +514,8 @@
         if (faultRole != null) {
             fault.getRole().setText((String) faultRole);
         } else if (axisFault != null) {
-            Map faultElementsMap = axisFault.getFaultElements();
-            if (faultElementsMap != null &&
-                    faultElementsMap.get(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME) != null) {
-                fault.setRole((SOAPFaultRole) faultElementsMap
-                        .get(SOAP12Constants.SOAP_FAULT_ROLE_LOCAL_NAME));
+            if (axisFault.getFaultRoleElement() != null) {
+                fault.setRole(axisFault.getFaultRoleElement());
             }
         }
 
@@ -535,11 +523,8 @@
         if (faultNode != null) {
             fault.getNode().setText((String) faultNode);
         } else if (axisFault != null) {
-            Map faultElementsMap = axisFault.getFaultElements();
-            if (faultElementsMap != null &&
-                    faultElementsMap.get(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME) != null) {
-                fault.setNode((SOAPFaultNode) faultElementsMap
-                        .get(SOAP12Constants.SOAP_FAULT_NODE_LOCAL_NAME));
+            if (axisFault.getFaultNodeElement() != null) {
+                fault.setNode(axisFault.getFaultNodeElement());
             }
         }
 
@@ -566,11 +551,8 @@
         if (faultDetail != null) {
             fault.setDetail((SOAPFaultDetail) faultDetail);
         } else if (axisFault != null) {
-            Map faultElementsMap = axisFault.getFaultElements();
-            if (faultElementsMap != null &&
-                    faultElementsMap.get(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME) != null) {
-                fault.setDetail((SOAPFaultDetail) faultElementsMap
-                        .get(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME));
+            if (axisFault.getFaultDetailElement() != null) {
+                fault.setDetail(axisFault.getFaultDetailElement());
             } else {
                 OMElement detail = axisFault.getDetail();
                 if (detail != null) {

Modified: webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/src/org/apache/axis2/saaj/SOAPFaultImpl.java Tue Mar 27 21:19:56 2007
@@ -485,9 +485,7 @@
 		if(soapFaultSubCode != null){
 			SOAPFaultValueImpl soapFaultValueimpl = new SOAP12FaultValueImpl(soapFaultSubCode,soapFactory);
 			soapFaultValueimpl.setText(subcode.getPrefix() +":" + subcode.getLocalPart());
-			OMNamespace  omNamespace = new OMNamespaceImpl(subcode.getNamespaceURI()
-					,this.element.getPrefix());
-			soapFaultValueimpl.setNamespace(omNamespace);
+			soapFaultValueimpl.declareNamespace(subcode.getNamespaceURI(), subcode.getPrefix());
 		}
     }
     
@@ -506,36 +504,13 @@
     public QName getFaultCodeAsQName() {
         SOAPFaultCode soapFaultCode = this.fault.getCode();
         if (soapFaultCode != null) {
-            String prefix = "";
-            String localPart = "";
-            String uri = "";
-            String text = "";
-            if(this.element.getOMFactory() instanceof SOAP11Factory) {
-                text = soapFaultCode.getText();
-            } else if(this.element.getOMFactory() instanceof SOAP12Factory){
-                text = soapFaultCode.getValue().getText();
+            if (this.element.getOMFactory() instanceof SOAP11Factory) {
+                return soapFaultCode.getTextAsQName();
+            } else {
+                return soapFaultCode.getValue().getTextAsQName();
             }
-            
-            if(text.indexOf(":") > 0) {
-                prefix = text.substring(0, text.indexOf(":"));
-                localPart = text.substring(text.indexOf(":") + 1);
-
-                if(this.element.getOMFactory() instanceof SOAP11Factory){
-                	uri  = soapFaultCode.findNamespaceURI(prefix).getNamespaceURI();
-                } else if(this.element.getOMFactory() instanceof SOAP12Factory){
-                    OMNamespace namespace = soapFaultCode.getValue().getNamespace();
-                    if (namespace != null) {
-                        uri = soapFaultCode.getValue().getNamespace().getNamespaceURI();
-                    } else {
-                        uri = this.fault.getNamespace().getNamespaceURI();
-                    }    
-                }
-            }
-
-            QName qname = new QName(uri, localPart, prefix);
-            return qname;
-    	}
-    	return null;
+        }
+        return null;
     }
 
     /**
@@ -692,36 +667,15 @@
     		throw new UnsupportedOperationException();
     	}
     	ArrayList faultSubcodes = new ArrayList();
-    	SOAPFaultSubCode firstSubCodeElement = this.fault.getCode().getSubCode();
-    	if(firstSubCodeElement != null){
-    		String text = firstSubCodeElement.getValue().getText();
-    		String prefix = text.substring(0,text.indexOf(":"));
-    		String localPart =  text.substring(text.indexOf(":")+1);
-    		String uri = firstSubCodeElement.getValue().getNamespace().getNamespaceURI();
-    		
-    		QName qname = new QName(uri,localPart,prefix);
+    	SOAPFaultSubCode subCodeElement = this.fault.getCode().getSubCode();
+    	while (subCodeElement != null){
+    		QName qname = subCodeElement.getValue().getTextAsQName();
     		faultSubcodes.add(qname);
-    		faultSubcodes = getChildSubCodes(firstSubCodeElement,faultSubcodes);
+    		subCodeElement = subCodeElement.getSubCode();
     	}
     	return faultSubcodes.iterator();
     }
 
-    private ArrayList getChildSubCodes(SOAPFaultSubCode firstSubCodeElement
-    		,ArrayList faultSubCodes){
-    	SOAPFaultSubCode  soapFaultSubCode = firstSubCodeElement.getSubCode();
-    	if( soapFaultSubCode != null){
-    		String text = soapFaultSubCode.getValue().getText();
-    		String prefix = text.substring(0,text.indexOf(":"));
-    		String localPart =  text.substring(text.indexOf(":")+1);
-    		String uri = soapFaultSubCode.getValue().getNamespace().getNamespaceURI();
-    		
-    		QName qname = new QName(uri,localPart,prefix);
-    		faultSubCodes.add(qname);
-    	}
-    	return faultSubCodes;
-    }
-    
-    
     /**
      * Returns true if this SOAPFault has a Detail subelement and false otherwise.
      */
@@ -791,7 +745,6 @@
     		soapFaultCode.setText(prefix + ":" + qname.getLocalPart());
     		OMNamespace omNamespace = new OMNamespaceImpl(qname.getNamespaceURI(),
     				qname.getPrefix());
-    		soapFaultCode.setNamespace(omNamespace);
     		soapFaultCode.declareNamespace(omNamespace);
     	} else if (this.element.getOMFactory() instanceof SOAP12Factory) {
     		SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
@@ -799,7 +752,7 @@
 			soapFaultValue.setText(prefix + ":" + qname.getLocalPart());
 			OMNamespace omNamespace = new OMNamespaceImpl(qname.getNamespaceURI(),
     						qname.getPrefix());
-			soapFaultValue.setNamespace(omNamespace);
+			soapFaultValue.declareNamespace(omNamespace);
 		}
     }
 

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SAAJDetailTest.java Tue Mar 27 21:19:56 2007
@@ -55,50 +55,38 @@
     /*
      * for soap version 1.1
      */
-    public void testAddDetailEntry() {
-    	try 
-    	{
-    		//Add a SOAPFault object to the SOAPBody
-    		SOAPFault sf = body.addFault();
-    		//Add a Detail object to the SOAPFault object
-    		Detail d = sf.addDetail();
-    		QName name = new QName("http://www.wombat.org/trader", 
-    				"GetLastTradePrice", "WOMBAT");
-    		//Add a DetailEntry object to the Detail object
-    		DetailEntry de = d.addDetailEntry(name);
-    		assertNotNull(de);
-    		assertTrue(de instanceof DetailEntry);
-    	} catch (Exception e) {
-    		fail("Exception: " + e);
-    	}
+    public void testAddDetailEntry() throws Exception {
+        //Add a SOAPFault object to the SOAPBody
+        SOAPFault sf = body.addFault();
+        //Add a Detail object to the SOAPFault object
+        Detail d = sf.addDetail();
+        QName name = new QName("http://www.wombat.org/trader",
+                               "GetLastTradePrice", "WOMBAT");
+        //Add a DetailEntry object to the Detail object
+        DetailEntry de = d.addDetailEntry(name);
+        assertNotNull(de);
+        assertTrue(de instanceof DetailEntry);
     }
 
     /*
      * for soap version 1.2
      */
-    public void testAddDetailEntry2() {
-    	try 
-    	{
-            msg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
-            sp = msg.getSOAPPart();
-            envelope = sp.getEnvelope();
-            body = envelope.getBody();
+    public void testAddDetailEntry2() throws Exception {
+        msg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage();
+        sp = msg.getSOAPPart();
+        envelope = sp.getEnvelope();
+        body = envelope.getBody();
     		
-    		//Add a SOAPFault object to the SOAPBody
-    		SOAPFault sf = body.addFault();
-    		//Add a Detail object to the SOAPFault object
-    		Detail d = sf.addDetail();
-    		QName name = new QName("http://www.wombat.org/trader", 
-    				"GetLastTradePrice", "WOMBAT");
-    		//Add a DetailEntry object to the Detail object
-    		DetailEntry de = d.addDetailEntry(name);
-    		//Successfully created DetailEntry object
-    		assertNotNull(de);
-    		assertTrue(de instanceof DetailEntry);
-    	} catch (Exception e) {
-    		fail("Exception: " + e);
-    	}
+        //Add a SOAPFault object to the SOAPBody
+        SOAPFault sf = body.addFault();
+        //Add a Detail object to the SOAPFault object
+        Detail d = sf.addDetail();
+        QName name = new QName("http://www.wombat.org/trader",
+                               "GetLastTradePrice", "WOMBAT");
+        //Add a DetailEntry object to the Detail object
+        DetailEntry de = d.addDetailEntry(name);
+        //Successfully created DetailEntry object
+        assertNotNull(de);
+        assertTrue(de instanceof DetailEntry);
     }
-    
-    
 }

Modified: webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java?view=diff&rev=523160&r1=523159&r2=523160
==============================================================================
--- webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java (original)
+++ webservices/axis2/trunk/java/modules/saaj/test/org/apache/axis2/saaj/SOAPFaultTest.java Tue Mar 27 21:19:56 2007
@@ -289,98 +289,86 @@
             fail("Unexpected Exception : " + e);
         }
     }
-    
-    public void testAppendSubCode() {
-        try 
-        {
-            MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
-            SOAPMessage soapMessage = fac.createMessage();
-            SOAPPart soapPart = soapMessage.getSOAPPart();
-            SOAPEnvelope envelope = soapPart.getEnvelope();
-            envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
-            SOAPBody body = envelope.getBody();
-            SOAPFault soapFault = body.addFault();
-            QName qname = new QName("http://example.com", "myfault1", "flt1");
-            soapFault.appendFaultSubcode(qname);
 
-            QName qname2 = new QName("http://example2.com", "myfault2", "flt2");
-            soapFault.appendFaultSubcode(qname2);
-            
-            QName qname3 = new QName("http://example3.com", "myfault3", "flt3");
-            soapFault.appendFaultSubcode(qname3);
-
-            soapMessage.saveChanges();
-            
-            Iterator faultSubCodes = soapFault.getFaultSubcodes();
-            assertNotNull(faultSubCodes);
-            
-        } catch (SOAPException e) {
-            fail("Unexpected Exception Occurred : " + e);
+    public void testAppendSubCode() throws Exception {
+        MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+        SOAPMessage soapMessage = fac.createMessage();
+        SOAPPart soapPart = soapMessage.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
+        SOAPBody body = envelope.getBody();
+        SOAPFault soapFault = body.addFault();
+        QName qname = new QName("http://example.com", "myfault1", "flt1");
+        soapFault.appendFaultSubcode(qname);
+
+        QName qname2 = new QName("http://example2.com", "myfault2", "flt2");
+        soapFault.appendFaultSubcode(qname2);
+
+        QName qname3 = new QName("http://example3.com", "myfault3", "flt3");
+        soapFault.appendFaultSubcode(qname3);
+
+        soapMessage.saveChanges();
+
+        Iterator faultSubCodes = soapFault.getFaultSubcodes();
+        assertNotNull(faultSubCodes);
+    }
+    
+    public void testAppendFaultSubCode() throws Exception {
+        MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+        SOAPMessage soapMessage = fac.createMessage();
+        SOAPPart soapPart = soapMessage.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
+        SOAPBody body = envelope.getBody();
+        SOAPFault sf = body.addFault();
+
+        QName expected1 = new QName("http://example.com", "myfault1", "flt1");
+        QName expected2 = new QName("http://example.com", "myfault2", "flt2");
+        boolean found1 = false;
+        boolean found2 = false;
+
+        //Appending fault Subcode
+        sf.appendFaultSubcode(expected1);
+        //Appending a second fault Subcode
+        sf.appendFaultSubcode(expected2);
+
+        //Getting FaultSubCodes from SOAPFault
+        Iterator i = sf.getFaultSubcodes();
+        int j = 0;
+        while (i.hasNext()){
+            Object o = i.next();
+            if (o != null && o instanceof QName){
+                QName actual = (QName)o;
+                if (actual.equals(expected1)){
+                    if (!found1){
+                        found1=true;
+                        //System.out.println("Subcode= '"+actual+"'");
+                    } else {
+                        //System.out.println("Received a duplicate Subcode :'"+actual+"'");
+                    }
+                } else if (actual.equals(expected2)){
+                    if (!found2){
+                        found2=true;
+                        //System.out.println("Subcode= '"+actual+"'");
+                    } else {
+                        //System.out.println("Received a duplicate Subcode :'"+actual+"'");
+                    }
+                }
+            }
+            j++;
+        }
+        if (j<1){
+            fail("No Subcode was returned");
+        }
+        if (j>2){
+            fail("More than two Subcodes were returned");
+        }
+        if (!found1){
+            fail("The following Subcode was not received: '"+expected1+"'");
+        }
+        if (!found2){
+            fail("The following Subcode was not received: '"+expected2+"'");
         }
-    }
-    
-    public void testAppendFaultSubCode(){
-    	try {
-    		MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
-    		SOAPMessage soapMessage = fac.createMessage();
-    		SOAPPart soapPart = soapMessage.getSOAPPart();
-    		SOAPEnvelope envelope = soapPart.getEnvelope();
-    		envelope.addNamespaceDeclaration("cwmp", "http://cwmp.com");
-    		SOAPBody body = envelope.getBody();
-    		SOAPFault sf = body.addFault();
-
-    		QName expected1 = new QName("http://example.com", "myfault1", "flt1");
-    		QName expected2 = new QName("http://example.com", "myfault2", "flt2");
-    		boolean found1 = false;
-    		boolean found2 = false;
-
-    		//Appending fault Subcode
-    		sf.appendFaultSubcode(expected1);
-    		//Appending a second fault Subcode
-    		sf.appendFaultSubcode(expected2);
-
-    		//Getting FaultSubCodes from SOAPFault
-    		Iterator i = sf.getFaultSubcodes();
-    		int j = 0;
-    		while (i.hasNext()){	
-    			Object o = i.next();
-    			if (o instanceof QName){
-    				QName actual = (QName)o; 
-    				if(actual != null){
-    					if (actual.equals(expected1)){
-    						if (!found1){
-    							found1=true;
-    							//System.out.println("Subcode= '"+actual+"'");
-    						} else {
-    							//System.out.println("Received a duplicate Subcode :'"+actual+"'");
-    						} 
-    					} else if (actual.equals(expected2)){
-    						if (!found2){
-    							found2=true;
-    							//System.out.println("Subcode= '"+actual+"'");
-    						} else {
-    							//System.out.println("Received a duplicate Subcode :'"+actual+"'");
-    						} 
-    					} 
-    				} 
-    			} 
-    			j++;
-    		}
-    		if (j<1){
-    			fail("No Subcode was returned");
-    		}
-    		if (j>2){
-    			fail("More than two Subcodes were returned");
-    		}
-    		if (!found1){
-    			fail("The following Subcode was not received: '"+expected1+"'");
-    		}
-    		if (!found2){
-    			fail("The following Subcode was not received: '"+expected2+"'");
-    		}
-    	} catch(Exception e) {
-    		fail("Exception: " + e);
-    	}
     }
     
     public void _testGetFaultReasonTexts() {
@@ -464,16 +452,14 @@
         	int j = 0;
         	while (i.hasNext()){	
         		Object o = i.next();
-        		if (o instanceof String){
-        			String actual = (String)o; 
-        			if(actual != null){
-        				if (actual.equals(expected)){
-        					if (!found){
-        						found=true;
-        					} 
-        				} 
-        			}
-        		} 
+        		if (o != null && o instanceof String){
+                    String actual = (String)o;
+                    if (actual.equals(expected)){
+                        if (!found){
+                            found=true;
+                        }
+                    }
+                }
         		j++;
         	}
         	if (j<1){
@@ -491,57 +477,51 @@
     }
     
 
-    public void testAddFaultReasonText4() {
-    	try {
-    		MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
-    		SOAPMessage soapMessage = fac.createMessage();
-    		SOAPPart soapPart = soapMessage.getSOAPPart();
-    		SOAPEnvelope envelope = soapPart.getEnvelope();
-    		SOAPBody body = envelope.getBody();
-    		SOAPFault sf = body.addFault();
-
-
-    		String expected1 = "Its my fault";
-    		String expected2 = "Its my fault again";
-    		boolean found1 = false;
-    		boolean found2 = false;
-    		sf.addFaultReasonText(expected1, Locale.UK);
-    		sf.addFaultReasonText(expected2, Locale.ENGLISH);
-    		Iterator i = sf.getFaultReasonTexts();
-    		int j = 0;
-    		while (i.hasNext()){	
-    			Object o = i.next();
-    			if (o instanceof String){
-    				String actual = (String)o; 
-    				if(actual != null){
-    					if (actual.equals(expected1)){
-    						if (!found1){
-    							found1=true;
-    						}
-    					}else if (actual.equals(expected2)){
-    						if (!found2){
-    							found2=true;
-    						}
-    					} 
-    				}
-    			}
-    			j++;
-    		}
-    		if (j<1){
-    			fail("No reason text was returned");
-    		}
-    		if (j>2){
-    			fail("More than two reason texts were returned");
-    		}
-    		if (!found1){
-    			fail("The following Reason text was not received: '"+expected1+"'");
-    		}
-    		if (!found2){
-    			fail("The following Reason text was not received: '"+expected2+"'");
-    		}
-    	} catch (SOAPException e) {
-    		fail("Unexpected Exception Occurred : " + e);
-    	}
+    public void testAddFaultReasonText4() throws Exception {
+        MessageFactory fac = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
+        SOAPMessage soapMessage = fac.createMessage();
+        SOAPPart soapPart = soapMessage.getSOAPPart();
+        SOAPEnvelope envelope = soapPart.getEnvelope();
+        SOAPBody body = envelope.getBody();
+        SOAPFault sf = body.addFault();
+
+
+        String expected1 = "Its my fault";
+        String expected2 = "Its my fault again";
+        boolean found1 = false;
+        boolean found2 = false;
+        sf.addFaultReasonText(expected1, Locale.UK);
+        sf.addFaultReasonText(expected2, Locale.ENGLISH);
+        Iterator i = sf.getFaultReasonTexts();
+        int j = 0;
+        while (i.hasNext()){
+            Object o = i.next();
+            if (o != null && o instanceof String){
+                String actual = (String)o;
+                if (actual.equals(expected1)){
+                    if (!found1){
+                        found1=true;
+                    }
+                } else if (actual.equals(expected2)){
+                    if (!found2){
+                        found2=true;
+                    }
+                }
+            }
+            j++;
+        }
+        if (j<1){
+            fail("No reason text was returned");
+        }
+        if (j>2){
+            fail("More than two reason texts were returned");
+        }
+        if (!found1){
+            fail("The following Reason text was not received: '"+expected1+"'");
+        }
+        if (!found2){
+            fail("The following Reason text was not received: '"+expected2+"'");
+        }
     }
     
     
@@ -882,22 +862,18 @@
     }
     
     
-    public void testSetGetFaultCodeAsQName1() {
-    	try {
-    		SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
-    		SOAPFault sf = fac.createFault();
-
-    		QName name = new QName("http://example.com", "myfault", "flt");
-    		sf.setFaultCode(name);
-    		QName name2 = sf.getFaultCodeAsQName();
-
-    		assertNotNull(name2);
-    		assertEquals(name2.getLocalPart(), name.getLocalPart());
-    		assertEquals(name2.getPrefix(), name.getPrefix());
-    		assertEquals(name2.getNamespaceURI(), name.getNamespaceURI());
-    	}catch(Exception e){
-    		fail(e.getMessage());
-    	}
+    public void testSetGetFaultCodeAsQName1() throws Exception {
+        SOAPFactory fac = SOAPFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
+        SOAPFault sf = fac.createFault();
+
+        QName name = new QName("http://example.com", "myfault", "flt");
+        sf.setFaultCode(name);
+        QName name2 = sf.getFaultCodeAsQName();
+
+        assertNotNull(name2);
+        assertEquals(name2.getLocalPart(), name.getLocalPart());
+        assertEquals(name2.getPrefix(), name.getPrefix());
+        assertEquals(name2.getNamespaceURI(), name.getNamespaceURI());
     }
     
    



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


Mime
View raw message