cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r532610 - in /incubator/cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ systests/src/test/java/org/apache/cxf/systest/jaxws/
Date Thu, 26 Apr 2007 05:14:20 GMT
Author: gawor
Date: Wed Apr 25 22:14:19 2007
New Revision: 532610

URL: http://svn.apache.org/viewvc?view=rev&rev=532610
Log:
in http binding throw HTTPExceptions

Modified:
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/JaxWsClientProxy.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java?view=diff&rev=532610&r1=532609&r2=532610
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
(original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/DispatchImpl.java
Wed Apr 25 22:14:19 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.jaxws;
 
+import java.net.HttpURLConnection;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -37,6 +38,8 @@
 import javax.xml.ws.Response;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.http.HTTPException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.logging.LogUtils;
@@ -144,7 +147,13 @@
         getConduitSelector().complete(exchange);
                 
         if (message.getContent(Exception.class) != null) {
-            throw new WebServiceException(message.getContent(Exception.class));
+            if (getBinding() instanceof HTTPBinding) {
+                HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
+                exception.initCause(message.getContent(Exception.class));
+                throw exception;
+            } else {
+                throw new WebServiceException(message.getContent(Exception.class));
+            }
         }
 
         // correlate response        

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=532610&r1=532609&r2=532610
==============================================================================
--- 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
Wed Apr 25 22:14:19 2007
@@ -21,6 +21,7 @@
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
+import java.net.HttpURLConnection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -35,6 +36,8 @@
 import javax.xml.ws.Response;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.http.HTTPException;
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
@@ -131,7 +134,14 @@
                     throw ex.fillInStackTrace();
                 }
             }
-            throw new WebServiceException(ex);
+            
+            if (getBinding() instanceof HTTPBinding) {
+                HTTPException exception = new HTTPException(HttpURLConnection.HTTP_INTERNAL_ERROR);
+                exception.initCause(ex);
+                throw exception;
+            } else {
+                throw new WebServiceException(ex);
+            }
         }
         // need to do context mapping from cxf message to jax-ws
         ContextPropertiesMapping.mapResponsefromCxf2Jaxws(respContext);

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java?view=diff&rev=532610&r1=532609&r2=532610
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerXMLTest.java
Wed Apr 25 22:14:19 2007
@@ -30,6 +30,7 @@
 import javax.xml.ws.BindingProvider;
 import javax.xml.ws.Holder;
 import javax.xml.ws.Service;
+import javax.xml.ws.http.HTTPException;
 import javax.xml.xpath.XPathConstants;
 
 import org.w3c.dom.Document;
@@ -272,8 +273,8 @@
         try {
             greeterFault.pingMe();
             fail("did not catch expected runtime exception");
-        } catch (Exception ex) {
-            assertTrue("check expected message of exception", ex.getMessage().indexOf(
+        } catch (HTTPException ex) {
+            assertTrue("check expected message of exception", ex.getCause().getMessage().indexOf(
                     GreeterFaultImpl.RUNTIME_EXCEPTION_MESSAGE) >= 0);
         }
     }



Mime
View raw message