axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ruchi...@apache.org
Subject svn commit: r515108 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/addressing/ addressing/src/org/apache/axis2/handlers/addressing/ integration/test/org/apache/axis2/engine/ integration/test/org/apache/axis2/engine/util/ ke...
Date Tue, 06 Mar 2007 12:49:48 GMT
Author: ruchithf
Date: Tue Mar  6 04:49:46 2007
New Revision: 515108

URL: http://svn.apache.org/viewvc?view=rev&rev=515108
Log:
Updated to match AXIOM changes (WSCOMMONS-104)


Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInFaultHandler.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CallUnregisteredServiceTest.java
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/AxisFault.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/MessageContextBuilder.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java?view=diff&rev=515108&r1=515107&r2=515108
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/addressing/AddressingFaultsHelper.java
Tue Mar  6 04:49:46 2007
@@ -233,15 +233,19 @@
     private static void setFaultCode(MessageContext messageContext, String faultCode, String
faultSubCode) {
         SOAPFactory soapFac = OMAbstractFactory.getSOAP12Factory();
         SOAPFaultCode soapFaultCode = soapFac.createSOAPFaultCode();
-        SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode);
-        soapFaultValue.setText(SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" + SOAP12Constants.FAULT_CODE_SENDER);
-        SOAPFaultSubCode soapFaultSubCode = soapFac.createSOAPFaultSubCode(soapFaultCode);
-        SOAPFaultValue soapFaultSubcodeValue = soapFac.createSOAPFaultValue(soapFaultSubCode);
-        soapFaultSubcodeValue.setText(AddressingConstants.WSA_DEFAULT_PREFIX + ":" + faultCode);
-        if (faultSubCode != null) {
-            SOAPFaultSubCode soapFaultSubCode2 = soapFac.createSOAPFaultSubCode(soapFaultSubCode);
-            SOAPFaultValue soapFaultSubcodeValue2 = soapFac.createSOAPFaultValue(soapFaultSubCode2);
-            soapFaultSubcodeValue2.setText(AddressingConstants.WSA_DEFAULT_PREFIX + ":" +
faultSubCode);
+        if(messageContext.isSOAP11()) {
+            soapFaultCode.setText(faultCode);
+        } else {
+            SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode);
+            soapFaultValue.setText(SOAP12Constants.SOAP_DEFAULT_NAMESPACE_PREFIX + ":" +
SOAP12Constants.FAULT_CODE_SENDER);
+            SOAPFaultSubCode soapFaultSubCode = soapFac.createSOAPFaultSubCode(soapFaultCode);
+            SOAPFaultValue soapFaultSubcodeValue = soapFac.createSOAPFaultValue(soapFaultSubCode);
+            soapFaultSubcodeValue.setText(AddressingConstants.WSA_DEFAULT_PREFIX + ":" +
faultCode);
+            if (faultSubCode != null) {
+                SOAPFaultSubCode soapFaultSubCode2 = soapFac.createSOAPFaultSubCode(soapFaultSubCode);
+                SOAPFaultValue soapFaultSubcodeValue2 = soapFac.createSOAPFaultValue(soapFaultSubCode2);
+                soapFaultSubcodeValue2.setText(AddressingConstants.WSA_DEFAULT_PREFIX + ":"
+ faultSubCode);
+            }
         }
         messageContext.setProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME, soapFaultCode);
     }

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=515108&r1=515107&r2=515108
==============================================================================
--- 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  6 04:49:46 2007
@@ -17,6 +17,7 @@
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPFault;
@@ -58,11 +59,14 @@
                     SOAPFault fault = envelope.getBody().getFault();
                     
                     SOAPFactory sf = ((SOAPFactory)envelope.getOMFactory());
-                    SOAPFaultText sft = sf.createSOAPFaultText();
-                    sft.setText(newReason);
                     SOAPFaultReason sfr = sf.createSOAPFaultReason();
-                    sfr.addSOAPText(sft);
-                    
+                    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,
@@ -83,7 +87,11 @@
         QName faultCodeQName = null;
         String result = null;
         if(fault != null){
-            faultCodeQName = fault.getCode().getValue().getTextAsQName();
+            if(envelope.getNamespace().getNamespaceURI().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
{
+                faultCodeQName = fault.getCode().getTextAsQName();
+            } else {
+                faultCodeQName = fault.getCode().getValue().getTextAsQName();
+            }
             if(fault.getCode().getSubCode() != null){
                 faultCodeQName = fault.getCode().getSubCode().getValue().getTextAsQName();
                 if(fault.getCode().getSubCode().getSubCode() != null){

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CallUnregisteredServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CallUnregisteredServiceTest.java?view=diff&rev=515108&r1=515107&r2=515108
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CallUnregisteredServiceTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/CallUnregisteredServiceTest.java
Tue Mar  6 04:49:46 2007
@@ -80,6 +80,8 @@
             fail("The test must fail due to wrong service Name");
 
         } catch (AxisFault e) {
+//            e.printStackTrace();
+            System.out.println(e.getMessage());
             assertTrue(e.getMessage().indexOf("Service not found for the") >= 0);
             tearDown();
             return;

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java?view=diff&rev=515108&r1=515107&r2=515108
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/util/FaultHandler.java
Tue Mar  6 04:49:46 2007
@@ -55,15 +55,23 @@
         if (ERR_HANDLING_WITH_MSG_CTXT.equals(firstElement.getLocalName())) {
             SOAPFaultCode soapFaultCode = soapFac.createSOAPFaultCode();
             soapFaultCode.declareNamespace("http://someuri.org", "m");
-            SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode);
-            soapFaultValue.setText(M_FAULT_EXCEPTION);
-
-            SOAPFaultText soapFaultText = soapFac.createSOAPFaultText();
-            soapFaultText.setLang("en");
-            soapFaultText.setText(FAULT_REASON);
+            if(msgContext.isSOAP11()) {
+                soapFaultCode.setText(M_FAULT_EXCEPTION);
+            } else {
+                SOAPFaultValue soapFaultValue = soapFac.createSOAPFaultValue(soapFaultCode);
+                soapFaultValue.setText(M_FAULT_EXCEPTION);
+            }
+            
             SOAPFaultReason soapFaultReason = soapFac.createSOAPFaultReason();
-            soapFaultReason.addSOAPText(soapFaultText);
 
+            if(msgContext.isSOAP11()) {
+                soapFaultReason.setText(FAULT_REASON);
+            } else {
+                SOAPFaultText soapFaultText = soapFac.createSOAPFaultText();
+                soapFaultText.setLang("en");
+                soapFaultText.setText(FAULT_REASON);
+                soapFaultReason.addSOAPText(soapFaultText);
+            }
 
             SOAPFaultDetail faultDetail = soapFac.createSOAPFaultDetail();
             faultDetail.addDetailEntry(detailEntry);

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=515108&r1=515107&r2=515108
==============================================================================
--- 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
 6 04:49:46 2007
@@ -185,7 +185,12 @@
         setToElementsListIfNotNull(SOAP12Constants.SOAP_FAULT_DETAIL_LOCAL_NAME, soapFaultDetail);
 
         if (soapFaultReason != null) {
-            message = soapFaultReason.getFirstSOAPText().getText();
+            if(soapFaultReason.getNamespace() != null && 
+                    soapFaultReason.getNamespace().getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
{
+                message = soapFaultReason.getFirstSOAPText().getText();
+            } else {
+                message = soapFaultReason.getText();
+            }
         }
 
         if (soapFaultDetail != null) {
@@ -201,7 +206,13 @@
         }
 
         if (soapFaultCode != null && soapFaultCode.getValue() != null) {
-            faultCode = soapFaultCode.getValue().getTextAsQName();
+            if(soapFaultReason.getNamespace() != null && 
+                    soapFaultReason.getNamespace().getNamespaceURI().equals(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI))
{
+                faultCode = soapFaultCode.getValue().getTextAsQName();
+            } else {
+                faultCode = soapFaultCode.getTextAsQName();
+            }
+            
         }
     }
 

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=515108&r1=515107&r2=515108
==============================================================================
--- 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  6 04:49:46 2007
@@ -423,7 +423,7 @@
 
         // user can set the fault information to the message context or to the AxisFault
itself.
         // whatever user sets to the message context, supercedes eerything.
-
+        
         Object faultCode = context.getProperty(SOAP12Constants.SOAP_FAULT_CODE_LOCAL_NAME);
         String soapFaultCode = "";
 
@@ -463,7 +463,11 @@
             soapFaultCode = ("".equals(soapFaultCode) || (soapFaultCode == null))
                     ? getSenderFaultCode(context.getEnvelope().getNamespace())
                     : soapFaultCode;
-            fault.getCode().getValue().setText(soapFaultCode);
+            if(context.isSOAP11()) {
+                fault.getCode().setText(soapFaultCode);
+            } else {
+                fault.getCode().getValue().setText(soapFaultCode);
+            }
         }
 
         Object faultReason = context.getProperty(SOAP12Constants.SOAP_FAULT_REASON_LOCAL_NAME);
@@ -471,7 +475,11 @@
 
         if (faultReason != null) {
             fault.setReason((SOAPFaultReason) faultReason);
-            message = fault.getReason().getFirstSOAPText().getText();
+            if(context.isSOAP11()) {
+                message = fault.getReason().getText();
+            } else {
+                message = fault.getReason().getFirstSOAPText().getText();
+            }
         } else if (soapException != null) {
             message = soapException.getMessage();
         } else if (axisFault != null) {
@@ -493,8 +501,12 @@
             message = ("".equals(message) || (message == null))
                     ? "unknown"
                     : message;
-            fault.getReason().getFirstSOAPText().setLang("en-US");
-            fault.getReason().getFirstSOAPText().setText(message);
+            if(context.isSOAP11()) {
+                fault.getReason().setText(message);
+            } else {
+                fault.getReason().getFirstSOAPText().setLang("en-US");
+                fault.getReason().getFirstSOAPText().setText(message);
+            }
         }
 
 



---------------------------------------------------------------------
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