Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1151526 - [GSS] (6.4.0) SAAJ SOAPConnection doesn't return SoapFault for HTTP 400
[GSS] (6.4.0) SAAJ SOAPConnection doesn't return SoapFault for HTTP 400
Status: VERIFIED
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web Services (Show other bugs)
6.4.0
Unspecified Unspecified
unspecified Severity medium
: ER1
: EAP 6.4.0
Assigned To: baranowb
Rostislav Svoboda
:
Depends On:
Blocks: 1157398 1151530
  Show dependency treegraph
 
Reported: 2014-10-10 11:32 EDT by Mustafa Musaji
Modified: 2015-03-19 07:42 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Known Issue
Doc Text:
XXXXX Cause: Consequence: Workaround (if any): Result:
Story Points: ---
Clone Of:
: 1151530 (view as bug list)
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
testing files (73.94 KB, application/zip)
2015-01-14 14:50 EST, Jan Blizňák
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker WFLY-3966 Major Closed Allow soapFaults to be returned for HTTP_BAD_REQUEST are per SOAP 1.2 spec 2016-08-22 19:00 EDT
Apache JIRA CXF-6198 None None None Never

  None (edit)
Description Mustafa Musaji 2014-10-10 11:32:39 EDT
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:
Comment 1 Mustafa Musaji 2014-10-17 05:15:47 EDT
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.
Comment 5 JBoss JIRA Server 2014-12-19 03:06:03 EST
Carlo de Wolf <cdewolf@redhat.com> updated the status of jira WFLY-3966 to Closed
Comment 7 Jan Blizňák 2015-01-14 14:32:37 EST
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
Comment 8 Jan Blizňák 2015-01-14 14:50:26 EST
Created attachment 980198 [details]
testing files

testing files I used, read the readme.txt for usage
Comment 10 Jan Blizňák 2015-01-15 05:37:48 EST
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?
Comment 24 Jan Blizňák 2015-03-18 10:10:25 EDT
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)

Note You need to log in before you can comment on or make changes to this bug.