This is an automated email from the ASF dual-hosted git repository. dkulp pushed a commit to branch 3.1.x-fixes in repository https://gitbox.apache.org/repos/asf/cxf.git
commit 4b08b5e92f4918a5ce2b849edd39f183931b5f06 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 (cherry picked from commit 1396f046333108ec0e7819bf4de154505ff4564c) --- 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 a1e9bed..8298cbc 100644 --- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java +++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java @@ -659,6 +659,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.