This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new 1396f04  [CXF-7653] Throw a more informative exception if the result 
could not be obtained from the response soap message
1396f04 is described below

commit 1396f046333108ec0e7819bf4de154505ff4564c
Author: Daniel Kulp <dk...@apache.org>
AuthorDate: Fri Feb 23 12:59:46 2018 -0500

    [CXF-7653] Throw a more informative exception if the result could not be 
obtained from the response soap message
---
 core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java  | 13 +++++++++++++
 .../java/org/apache/cxf/systest/soap/EmptySOAPBodyTest.java | 10 ++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java 
b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
index 71aab24..6beecac 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -651,6 +651,19 @@ public class ClientImpl
             throw ex;
         }
 
+        if (resList == null   
+            && oi != null && !oi.getOperationInfo().isOneWay()) {
+            
+            BindingOperationInfo boi = oi;
+            if (boi.isUnwrapped()) {
+                boi = boi.getWrappedOperation();
+            }
+            if (!boi.getOutput().getMessageParts().isEmpty()) {
+                //we were supposed to get some output, but didn't
+                throw new IllegalStateException("Response message did not 
contain proper response data. Expected: "
+                    + 
boi.getOutput().getMessageParts().get(0).getConcreteName());
+            }
+        }
         if (resList != null) {
             return resList.toArray();
         }
diff --git 
a/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/EmptySOAPBodyTest.java
 
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/EmptySOAPBodyTest.java
index 2cc103d..9d0b6e2 100644
--- 
a/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/EmptySOAPBodyTest.java
+++ 
b/systests/uncategorized/src/test/java/org/apache/cxf/systest/soap/EmptySOAPBodyTest.java
@@ -23,6 +23,7 @@ import java.net.URL;
 
 import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
+import javax.xml.ws.soap.SOAPFaultException;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -35,7 +36,6 @@ import org.junit.BeforeClass;
 /**
  * Test what happens when we make an invocation and get back an empty SOAP 
Body (see CXF-7653)
  */
-@org.junit.Ignore("Ignoring this until CXF-7653 is resolved")
 public class EmptySOAPBodyTest extends AbstractBusClientServerTestBase {
     static final String PORT = allocatePort(EmptySOAPBodyServer.class);
 
@@ -74,7 +74,13 @@ public class EmptySOAPBodyTest extends 
AbstractBusClientServerTestBase {
                 service.getPort(portQName, DoubleItPortType.class);
         updateAddressPort(port, PORT);
 
-        port.doubleIt(25);
+        try {
+            port.doubleIt(25);
+            fail("Should have thown an exception");
+        } catch (SOAPFaultException t) {
+            assertTrue("Wrong exception cause " + t.getCause(), 
+                 t.getCause() instanceof IllegalStateException);
+        }
 
         ((java.io.Closeable)port).close();
 

-- 
To stop receiving notification emails like this one, please contact
dk...@apache.org.

Reply via email to