cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r530535 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/service/model/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/src/test/java/org/apache/cxf/systest/coloc/ systests/src/test/java/org/apache/cxf/systest/jaxw...
Date Thu, 19 Apr 2007 20:11:25 GMT
Author: dkulp
Date: Thu Apr 19 13:11:24 2007
New Revision: 530535

URL: http://svn.apache.org/viewvc?view=rev&rev=530535
Log:
Make jaxws proxies map undeclared exceptions to WebServiceException. (still need to map HTTP
and SOAP stuff to SoapFaultException and HTTPException)
Fix Async calls not actually being Async with Andrea's latest commit

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractHeaderServiceRpcLitTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPClientPolicyTest.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Thu
Apr 19 13:11:24 2007
@@ -120,7 +120,9 @@
         }
         return null;*/
         String uri = qname.getNamespaceURI();
-        if (schema.getTargetNamespace().equals(uri)) {
+        if (schema != null 
+            && schema.getTargetNamespace() != null
+            && schema.getTargetNamespace().equals(uri)) {
             return schema.getElementByName(qname);
         }
         return null;

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
Thu Apr 19 13:11:24 2007
@@ -115,10 +115,23 @@
         boolean isAsync = method.getName().endsWith("Async");
 
         Object result = null;
-        if (isAsync) {
-            result = invokeAsync(method, oi, params, context);
-        } else {
-            result = invokeSync(method, oi, params, context);
+        try {
+            if (isAsync) {
+                result = invokeAsync(method, oi, params, context);
+            } else {
+                result = invokeSync(method, oi, params, context);
+            }
+        } catch (WebServiceException wex) {
+            throw wex.fillInStackTrace();
+        } catch (Exception ex) {
+            //TODO - map to SoapFaultException and HTTPException
+            
+            for (Class<?> excls : method.getExceptionTypes()) {
+                if (excls.isInstance(ex)) {
+                    throw ex.fillInStackTrace();
+                }
+            }
+            throw new WebServiceException(ex);
         }
         // need to do context mapping from cxf message to jax-ws
         ContextPropertiesMapping.mapResponsefromCxf2Jaxws(respContext);
@@ -138,7 +151,7 @@
             // callback style
             AsyncCallbackFuture callback = 
                 new AsyncCallbackFuture(r, (AsyncHandler)params[params.length - 1]);
-            endpoint.getService().getExecutor().execute(callback);
+            endpoint.getExecutor().execute(callback);
             return callback;
         } else {
             return r;

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
Thu Apr 19 13:11:24 2007
@@ -67,6 +67,7 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
+import org.apache.cxf.workqueue.OneShotAsyncExecutor;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
 
 public class ServiceImpl extends ServiceDelegate {
@@ -291,11 +292,10 @@
         service.setExecutor(new Executor() {
             public void execute(Runnable command) {
                 Executor ex = getExecutor();
-                if (ex != null) {
-                    ex.execute(command);
-                } else {
-                    command.run();
-                }
+                if (ex == null) {
+                    ex = OneShotAsyncExecutor.getInstance();
+                } 
+                ex.execute(command);
             }
         });
         configureObject(service);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractHeaderServiceRpcLitTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractHeaderServiceRpcLitTest.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractHeaderServiceRpcLitTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/coloc/AbstractHeaderServiceRpcLitTest.java
Thu Apr 19 13:11:24 2007
@@ -22,10 +22,10 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Holder;
+import javax.xml.ws.WebServiceException;
 
 import static junit.framework.Assert.assertEquals;
 
-import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.headers.coloc.types.FaultDetailT;
 import org.apache.headers.coloc.types.HeaderInfo;
@@ -210,7 +210,7 @@
             in.setFaultType("SYSTEM");
             ht.pingMe(in);
             fail("Should throw a CXF Fault exception");
-        } catch (Fault fault) {
+        } catch (WebServiceException fault) {
             assertFalse(-1 == fault.getMessage().lastIndexOf(HeaderTesterUtil.EX_STRING));
             if (isFaultCodeCheckEnabled()) {
                 verifyFaultCode(port);
@@ -224,7 +224,7 @@
             in.setFaultType("RUNTIME");
             ht.pingMe(in);
             fail("Should throw a CXF Fault exception");
-        } catch (Fault fault) {
+        } catch (WebServiceException fault) {
             assertFalse(-1 == fault.getMessage().lastIndexOf(HeaderTesterUtil.EX_STRING));
             if (isFaultCodeCheckEnabled()) {
                 verifyFaultCode(port);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Thu Apr 19 13:11:24 2007
@@ -38,6 +38,7 @@
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
 import javax.xml.xpath.XPathConstants;
 
 import org.w3c.dom.Document;
@@ -50,7 +51,6 @@
 //import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.helpers.XPathUtils;
-import org.apache.cxf.interceptor.Fault;
 //import org.apache.cxf.jaxws.ServiceImpl;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -554,9 +554,9 @@
             // trigger runtime exception throw of implementor method
             greeter.testDocLitFault("");
             fail("Should have thrown Runtime exception");
-        } catch (Exception e) {
-            assertEquals("can't get back original message", "Unknown source", e.getMessage());
-            assertTrue(e.getStackTrace().length > 0);            
+        } catch (WebServiceException e) {
+            assertEquals("can't get back original message", "Unknown source", e.getCause().getMessage());
+            assertTrue(e.getCause().getStackTrace().length > 0);            
         }
     }
     
@@ -708,7 +708,7 @@
         try {
             greeter.greetMe("test");
             fail("Should fail");
-        } catch (Fault f) {
+        } catch (WebServiceException f) {
             // expected
         }
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/schema_validation/ValidationClientServerTest.java
Thu Apr 19 13:11:24 2007
@@ -24,6 +24,7 @@
 import java.util.List;
 
 import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
@@ -75,10 +76,10 @@
             /*boolean result =*/
             validation.setComplexStruct(complexStruct);
             fail("Set ComplexStruct hould have thrown ProtocolException");
-        } catch (Exception e) {
-            assertTrue(e instanceof Fault);
+        } catch (WebServiceException e) {
+            assertTrue(e.getCause() instanceof Fault);
             String expected = "'{\"http://apache.org/schema_validation/types\":elem2}' is
expected.";
-            assertTrue(e.getMessage().indexOf(expected) != -1);
+            assertTrue(e.getCause().getMessage().indexOf(expected) != -1);
         }
 
         OccuringStruct occuringStruct = new OccuringStruct();
@@ -92,10 +93,10 @@
             /*boolean result =*/
             validation.setOccuringStruct(occuringStruct);
             fail("Set OccuringStruct hould have thrown ProtocolException");
-        } catch (Exception e) {
-            assertTrue(e instanceof Fault);
+        } catch (WebServiceException e) {
+            assertTrue(e.getCause() instanceof Fault);
             String expected = "'{\"http://apache.org/schema_validation/types\":varFloat}'
is expected.";
-            assertTrue(e.getMessage().indexOf(expected) != -1);
+            assertTrue(e.getCause().getMessage().indexOf(expected) != -1);
         }
 
         try {
@@ -105,10 +106,10 @@
             /*complexStruct =*/
             validation.getComplexStruct("Hello");
             fail("Get ComplexStruct should have thrown ProtocolException");
-        } catch (Exception e) {
-            assertTrue(e instanceof Fault);
+        } catch (WebServiceException e) {
+            assertTrue(e.getCause() instanceof Fault);
             String expected = "'{\"http://apache.org/schema_validation/types\":elem2}' is
expected.";
-            assertTrue(e.getMessage().indexOf(expected) != -1);
+            assertTrue(e.getCause().getMessage().indexOf(expected) != -1);
         }
 
         try {
@@ -118,10 +119,10 @@
             /*occuringStruct =*/
             validation.getOccuringStruct("World");
             fail("Get OccuringStruct should have thrown ProtocolException");
-        } catch (Exception e) {
-            assertTrue(e instanceof Fault);
+        } catch (WebServiceException e) {
+            assertTrue(e.getCause() instanceof Fault);
             String expected = "'{\"http://apache.org/schema_validation/types\":varFloat}'
is expected.";
-            assertTrue(e.getMessage().indexOf(expected) != -1);
+            assertTrue(e.getCause().getMessage().indexOf(expected) != -1);
         }
     }
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPClientPolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPClientPolicyTest.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPClientPolicyTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPClientPolicyTest.java
Thu Apr 19 13:11:24 2007
@@ -25,6 +25,7 @@
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -120,7 +121,8 @@
         try {
             greeter.sayHi();
             fail("Did not receive expected PolicyException.");
-        } catch (PolicyException ex) {
+        } catch (WebServiceException wex) {
+            PolicyException ex = (PolicyException)wex.getCause();
             assertEquals("INCOMPATIBLE_HTTPCLIENTPOLICY_ASSERTIONS", ex.getCode());
         }
 

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java?view=diff&rev=530535&r1=530534&r2=530535
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/policy/HTTPServerPolicyTest.java
Thu Apr 19 13:11:24 2007
@@ -22,6 +22,7 @@
 import java.util.logging.Logger;
 
 import javax.xml.ws.Endpoint;
+import javax.xml.ws.WebServiceException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.SoapFault;
@@ -114,7 +115,8 @@
         try {
             greeter.sayHi();
             fail("Did not receive expected Exception.");
-        } catch (SoapFault sf) {
+        } catch (WebServiceException wse) {
+            SoapFault sf = (SoapFault)wse.getCause();
             assertEquals("Server", sf.getFaultCode().getLocalPart());
             assertEquals("None of the policy alternatives can be satisfied.", sf.getMessage());
             // assertEquals("INCOMPATIBLE_HTTPSERVERPOLICY_ASSERTIONS", ex.getCode());



Mime
View raw message