Bug 1151526

Summary: [GSS] (6.4.0) SAAJ SOAPConnection doesn't return SoapFault for HTTP 400
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Mustafa Musaji <mmusaji>
Component: Web ServicesAssignee: baranowb <bbaranow>
Status: CLOSED CURRENTRELEASE QA Contact: Rostislav Svoboda <rsvoboda>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: asoldano, bbaranow, cdewolf, jawilson, jbliznak, klape, myarboro
Target Milestone: ER1   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
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: 2019-08-19 12:45:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1151530, 1157398    
Attachments:
Description Flags
testing files none

Description Mustafa Musaji 2014-10-10 15:32:39 UTC
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 09:15:47 UTC
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 08:06:03 UTC
Carlo de Wolf <cdewolf> updated the status of jira WFLY-3966 to Closed

Comment 7 Jan Blizňák 2015-01-14 19:32:37 UTC
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 19:50:26 UTC
Created attachment 980198 [details]
testing files

testing files I used, read the readme.txt for usage

Comment 10 Jan Blizňák 2015-01-15 10:37:48 UTC
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 14:10:25 UTC
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)