Repository navigation
Do not consider an HTTP error without content a SOAP fault - #1947
Open
sharanggupta wants to merge 1 commit into
Open
sharanggupta wants to merge 1 commit into
sharanggupta wants to merge 1 commit into
Conversation
A response with a 500 status code, or a 400 status code for SOAP 1.2, and a SOAP content type was considered a fault even when it had no content. WebServiceTemplate then skipped its error handling, found no response, and returned as if the call had succeeded. AbstractHttpSenderConnection.hasFault() now also requires a response, so such an error is reported as a WebServiceTransportException, like an error with another content type already is. See spring-projectsgh-1028 Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes #1028, which still reproduces on
main.When a server answers with a 500 status code (or 400 for SOAP 1.2) and a SOAP content type,
AbstractHttpSenderConnection.hasFault()returnstrue, soWebServiceTemplate.hasError()treats the response as a fault instead of an error. If the response has no content,receive()then returnsnull, the template logs "Received no response for request", and the call returns as if it had succeeded (null, orfalseforsendSourceAndReceiveToResult). The same error with another content type, or without a content type, already fails with aWebServiceTransportException.hasFault()now also requires a response, since a fault is carried in the response. An empty 500 (or 400 for SOAP 1.2) is therefore handled as an error and raises aWebServiceTransportExceptionwith the status, for instanceServer Error [500].hasResponse()caches its result and keeps the byte it peeks when the content length is unknown, so calling it beforereceive()does not change whatreceive()reads.Testing
Developed test first: the new tests failed against
mainand pass with the change.AbstractHttpWebServiceMessageSenderIntegrationTests: an empty 500 with atext/xmlcontent type is an error and not a fault, for the six HTTP message senders.AbstractSoap11WebServiceTemplateIntegrationTestsandAbstractSoap12WebServiceTemplateIntegrationTests: theWebServiceTemplateraises aWebServiceTransportExceptionfor an empty 500 (and an empty 400 for SOAP 1.2) with a SOAP content type, for the SAAJ and Axiom message factories../gradlew :spring-ws-core:check :spring-ws-core:javadocpasses locally on JDK 25 (1044 tests inspring-ws-core, none skipped).