spring-ws icon indicating copy to clipboard operation
spring-ws copied to clipboard

HTTP 500 with no fault is not handled correctly [SWS-956]

Open gregturn opened this issue 9 years ago • 4 comments

Ivan Brencsics opened SWS-956 and commented

When Spring WS makes a SOAP call, and receives back HTTP 500, it ignores the response code, and considers the call as successful:

o.a.h.wire | http-outgoing-0 << "HTTP/1.1 500 Internal Server Error [\r][\n]" o.a.h.wire | http-outgoing-0 << "Content-Type: application/soap+xml[\r][\n]" o.a.h.wire | http-outgoing-0 << "Content-Length: 0[\r][\n]" o.a.h.wire | http-outgoing-0 << "Server: WEBrick/1.3.1 (Ruby/1.9.1/2009-12-07) OpenSSL/0.9.8e-rhel5[\r][\n]" o.a.h.wire | http-outgoing-0 << "Date: Fri, 15 Apr 2016 14:46:53 GMT[\r][\n]" o.a.h.wire | http-outgoing-0 << "Connection: Keep-Alive[\r][\n]" o.a.h.wire | http-outgoing-0 << "[\r][\n]" o.a.h.imp~.exe~.MainClientExec | Connection can be kept alive indefinitely o.s.w.cli~.Mes~.received | Received no response for request [...]

On the contrary, when receiving 50x other then 500, it fails properly:

o.s.w.cli~.cor~.WebServiceTemplate | Received error for request [...]


Affects: 2.2.0.RELEASE

gregturn avatar Apr 15 '16 21:04 gregturn

Ivan Brencsics commented

I managed to find to root cause of the problem. It Spring WS receives a HTTP 500 error that has a Content-Type (such as above), it considers the calls as successful. If there is no Content-Type, the call fails, and an exception is thrown. Does this implementation have any reason?

gregturn avatar Apr 18 '16 11:04 gregturn

Ivan Brencsics commented

Things are happening fast now: I found that HTTP 500 + Content-Type=application/soap+xml is handled similarly like 200 OK by Spring WS, because it can carry a SOAP fault. So this can justify the Spring WS implementation. The only problem is that we encountered now this case when there is an empty HTTP 500 response with that Content-Type. I think this can happen any time, if a web server is not following perfectly the best practices.

gregturn avatar Apr 18 '16 12:04 gregturn