axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r497674 - in /webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample: FaultsServiceTests.java faultsservice/FaultsServiceSoapBindingImpl.java
Date Fri, 19 Jan 2007 01:20:50 GMT
Author: scheu
Date: Thu Jan 18 17:20:49 2007
New Revision: 497674

URL: http://svn.apache.org/viewvc?view=rev&rev=497674
Log:
AXIS2-1984
Contributor:Rich Scheuerle
Additional test: Server throws WebServiceException...client should throw SOAPFaultException
with same message string.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java?view=diff&rev=497674&r1=497673&r2=497674
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/FaultsServiceTests.java
Thu Jan 18 17:20:49 2007
@@ -317,4 +317,31 @@
         assertTrue(soapFault != null);
         assertTrue(soapFault.getFaultString().contains("NullPointerException"));
     }
+    
+    /**
+     * Tests that that SOAPFaultException (for WebServiceException) is thrown 
+     */
+    public void testFaultsService11(){
+        Exception exception = null;
+        try{
+            FaultsServicePortType proxy = getProxy();
+            
+            // the invoke will throw an exception, if the test is performed right
+            int total = proxy.throwFault(2, "WSE", 2);  // "WSE" will cause service to throw
WebServiceException System Exception
+            
+        }catch(SOAPFaultException e){
+            // Okay...on the client a SOAPFaultException should be thrown
+            exception = e;
+        } catch (Exception e) {
+            fail("Did not get a SOAPFaultException");
+        }
+        
+        System.out.println("----------------------------------");
+        
+        assertNotNull(exception);
+        SOAPFaultException sfe = (SOAPFaultException) exception;
+        SOAPFault soapFault = sfe.getFault();
+        assertTrue(soapFault != null);
+        assertTrue(soapFault.getFaultString().equals("This is a WebServiceException"));
+    }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java?view=diff&rev=497674&r1=497673&r2=497674
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/sample/faultsservice/FaultsServiceSoapBindingImpl.java
Thu Jan 18 17:20:49 2007
@@ -20,6 +20,7 @@
 import javax.xml.soap.SOAPFactory;
 import javax.xml.soap.SOAPFault;
 import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.axiom.om.impl.dom.DOOMAbstractFactory;
@@ -110,6 +111,9 @@
             } catch (SOAPException se) {}
         } else if (b.equals("NPE")) {
             throw new NullPointerException();
+        } else if (b.equals("WSE")) {
+            WebServiceException wsf = new WebServiceException("This is a WebServiceException");
+            throw wsf;
         }
         return 0;
     }



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