Description of problem: The issue and fix is described in the upstream JIRA https://java.net/jira/browse/SAAJ-74 Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Server returns stack trace and the exception is lost Expected results: When server returns http 400, a soapFault is expected with the error Additional info:
Upstream SAAJ bug (SAAJ-74) hasn't been committed yet. In the meantime, I've created an internal tag that contains this fix. http://git.app.eng.bos.redhat.com/git/saaj-impl.git/tag/?id=1.3.16-SP1-redhat-3 We should upgrade the 6.4.0 release to this version if SAAJ-74 has not yet been fixed. If it has we need to create another tag, ensure this fix is in it and then pull that one in.
Carlo de Wolf <cdewolf> updated the status of jira WFLY-3966 to Closed
fixed saaj-impl jar (with fix in com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection) is present in 6.4.0.ER1 HOWEVER, JBossWS does not use com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection INSTEAD it loads custom SOAPConnectionImpl, which use org.apache.cxf.transport.http.HTTPConduit and that doesn't return SOAPFault for HTTP 400 The failing usecase: 1) running remote server that responds with either 500+SOAP Fault or 400+SOAP Fault (for example wiremock server responding with 400 at http://localhost:8081/400) 2) invoke servlet which send request to the remote server: SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance(); SOAPConnection connection = factory.createConnection(); MessageFactory mf = MessageFactory.newInstance(); SOAPMessage reqMsg = mf.createMessage(); URL endpoint = new URL("http://localhost:8081/400"); SOAPMessage response = connection.call(reqMsg, endpointUrl); if (response.getSOAPBody().hasFault()) { System.out.println("Correct, SOAP fault is returned for " + url); System.out.println("SOAP fault reasons:"); System.out.println(response.getSOAPBody().getFault().getFaultReasonText(Locale.ENGLISH)); } else { System.out.println("FAIL, SOAP fault should be returned for " + url); } This will lead to: javax.xml.soap.SOAPException: JBWS024004: SOAP message could not be sent at org.jboss.wsf.stack.cxf.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:128) at com.redhat.SAAJInvokingServlet.getRemoteResponse(SAAJInvokingServlet.java:76) at com.redhat.SAAJInvokingServlet.doGet(SAAJInvokingServlet.java:53) at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '400: Bad Request' when communicating with http://localhost:8081/400 at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1563) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1515) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1318) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:632) at org.jboss.wsf.stack.cxf.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:124) ... 17 more
Created attachment 980198 [details] testing files testing files I used, read the readme.txt for usage
ok, we could add: outMessage.put("org.apache.cxf.transport.no_io_exceptions", "true"); just before this line: https://source.jboss.org/browse/~br=stack-cxf-jbossws-cxf-4.3.x/JBossWS/stack/cxf/branches/jbossws-cxf-4.3.x/modules/client/src/main/java/org/jboss/wsf/stack/cxf/saaj/SOAPConnectionImpl.java?hb=true#to117 but I am not sure, if it is what we want - doesn't it then let all HTTP codes through, not just 400 and 500?
OK then, as I already stated in comment 7, the fix for com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection in saaj-impl was present in 6.4.0.ER1 (and is still present in 6.4.0.CR1)