Alex T
Alex T

Reputation: 1376

SOAP and HTTP response codes

Is SOAP end-point over HTTP expected to return any status code except 200 and 500? I have a SOAP end-point that has some business logic to reject requests when there are too many of them. I wonder what is the correct HTTP response code in this case - 500 or 429? The SOAP specification seems vague to me:

SOAP HTTP follows the semantics of the HTTP Status codes for communicating status information in HTTP. For example, a 2xx status code indicates that the client's request including the SOAP component was successfully received, understood, and accepted etc.

In case of a SOAP error while processing the request, the SOAP HTTP server MUST issue an HTTP 500 "Internal Server Error" response and include a SOAP message in the response containing a SOAP Fault element (see section 4.4) indicating the SOAP processing error.

Upvotes: 10

Views: 32451

Answers (1)

Namphibian
Namphibian

Reputation: 12221

In short SOAP uses HTTP/HTTPS as a transport. It is not bound to HTTP/S. SOAP can also use SMTP and JMS as a transport. Yes you can do SOAP via email.

The 200 and 500 error codes mentioned is just the standard way of letting SOAP know that the message contains a successful or failed SOAP request. Thus I would use 500 with the error logged in the standard SOAP fault.

Upvotes: 11

Related Questions