There is a bug in soap_envelope_begin_in: when request body doesn't contain "SOAP-ENV:Envelope" or "Envelope" tag, it returns status as an error. In my case it's SOAP_POST which is greater than SOAP_STOP. That leads to silent closing of socket without sending any response.
soap_envelope_begin_in(struct soap *soap)
{
soap->part = SOAP_IN_ENVELOPE;
if (soap_element_begin_in(soap, "SOAP-ENV:Envelope", 0, NULL))
{
if (soap->error == SOAP_TAG_MISMATCH)
{
if (!soap_element_begin_in(soap, "Envelope", 0, NULL))
soap->error = SOAP_VERSIONMISMATCH;
else if (soap->status == 0
|| (soap->status >= 200 && soap->status <= 299)
|| soap->status == 400
|| soap->status == 500)
return SOAP_OK; /* allow non-SOAP (REST) XML content to be captured */
soap->error = soap->status; //<--- this line looks strange
}
The mentioned line overrides "soap->error = SOAP_VERSIONMISMATCH" result. I guess the line should be removed so the function returned SOAP_VERSIONMISMATCH when "Envelope" tag exists and SOAP_TAG_MISMATCH (resulting error of the second soap_element_begin_in) when no "Envelope" or "SOAP-ENV:Envelope" tags exist in the body. I've tried removing it and now I got "Validation constraint violation: tag name or namespace mismatch in element 'raml'" response on bad-body requests, which looks good for me.
This logic is required for SOAP 1.1/1.2 standard compliance. A version mismatch must be reported if the SOAP namespace does not match. In that case it is not a validation constraint error.
Silent closing of socket without sending error response is a bug!
Not sure where you get that information from. The engine does not silently close the socket. When an error occurs, the server logic responds with an Fault message and then closes the socket, See the code in
soap_begin_serve()that is responsible for this. The logic can be improved with a minor change to capture SOAP mismatch errors only when the element tag is qualified:It did close the socket when I reported the bug, not sure how the code was changed since than. I got that from a project I worked at.
Adding
returnlooks very close to removing that strange-looking line as in that case the line will not get control and the only difference is whatsoap_envelope_begin_indoes afterifblocks. If that's enough please add the change to the project's source code.