You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2018/07/23 23:34:00 UTC
[jira] [Resolved] (CXF-7798) Mapping of SOAP Faults in Asynchronous
JAX-WS Client
[ https://issues.apache.org/jira/browse/CXF-7798?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved CXF-7798.
------------------------------
Resolution: Fixed
Assignee: Daniel Kulp
Fix Version/s: 3.3.0
3.2.6
> Mapping of SOAP Faults in Asynchronous JAX-WS Client
> ----------------------------------------------------
>
> Key: CXF-7798
> URL: https://issues.apache.org/jira/browse/CXF-7798
> Project: CXF
> Issue Type: Bug
> Components: JAX-WS Runtime
> Affects Versions: 3.2.5
> Reporter: Giedrius Noreikis
> Assignee: Daniel Kulp
> Priority: Major
> Fix For: 3.2.6, 3.3.0
>
>
> When a SOAP fault is received, asynchronous JAX-WS client throws {{ExecutionException}} with a CXF-specific {{SoapFault}} as its cause:
> {code:java}
> Caused by: java.util.concurrent.ExecutionException: org.apache.cxf.binding.soap.SoapFault: ...
> at org.apache.cxf.endpoint.ClientCallback.get(ClientCallback.java:147)
> at org.apache.cxf.jaxws.JaxwsResponseCallback.get(JaxwsResponseCallback.java:49)
> ...
> {code}
> Instead, the cause of {{ExecutionException}} is supposed to contain an instance of {{javax.xml.ws.soap.SOAPFaultException}} in this case, as the mapping should be identical for both asynchronous and synchronous cases.
> Steps to reproduce:
> # Create and publish a service:
> TestService.java:
> {code:java}
> package test;
> import javax.jws.WebMethod;
> import javax.jws.WebService;
> @WebService
> public interface TestService {
> @WebMethod
> void test();
> }
> {code}
> TestServiceImpl.java:
> {code:java}
> package test;
> import javax.jws.WebService;
> import javax.xml.ws.Endpoint;
> @WebService(endpointInterface = "test.TestService")
> public class TestServiceImpl implements TestService {
> @Override
> public void test() {
> throw new IllegalArgumentException("test");
> }
> public static void main(String[] args) {
> Endpoint.publish("http://localhost:8888/service/test", new TestServiceImpl());
> }
> }
> {code}
> # Generate a client:
> {code}
> wsimport -b bindings.xml -keep http://localhost:8888/service/test?wsdl
> {code}
> bindings.xml:
> {code:xml}
> <bindings xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns="http://java.sun.com/xml/ns/jaxws">
> <bindings node="wsdl:definitions/wsdl:portType[@name='TestService']/wsdl:operation[@name='test']">
> <enableAsyncMapping>true</enableAsyncMapping>
> </bindings>
> </bindings>
> {code}
> # Use the service:
> {code:java}
> try {
> testService.test();
> } catch (SOAPFaultException e) {
> System.out.println("good");
> }
> try {
> testService.testAsync().get();
> } catch (ExecutionException e) {
> if (e.getCause() instanceof SOAPFaultException) {
> System.out.println("good");
> } else {
> System.out.println("bad"); // fails with CXF
> }
> }
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)