SOAP 和 HTTP 响应代码 [英] SOAP and HTTP response codes

查看:46
本文介绍了SOAP 和 HTTP 响应代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于 HTTP 的 SOAP 端点是否会返回除 200 和 500 之外的任何状态代码?我有一个 SOAP 端点,它具有一些业务逻辑,可以在请求过多时拒绝请求.我想知道在这种情况下正确的 HTTP 响应代码是什么 - 500 或 429?SOAP 规范 对我来说似乎很模糊:

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 遵循 HTTP 状态代码的语义,用于在 HTTP 中传递状态信息.例如,2xx 状态代码表明客户端的请求包括 SOAP 组件被成功接收、理解、接受等

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.

如果在处理请求时发生 SOAP 错误,SOAP HTTP服务器必须发出 HTTP 500内部服务器错误"响应和在包含 SOAP Fault 元素的响应中包含 SOAP 消息(请参阅第 4.4 节)指示 SOAP 处理错误.

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.

推荐答案

简而言之,SOAP 使用 HTTP/HTTPS 作为传输.它不绑定到 HTTP/S.SOAP 还可以使用 SMTP 和 JMS 作为传输.是的,您可以通过电子邮件执行 SOAP.

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.

提到的 200 和 500 错误代码只是让 SOAP 知道消息包含成功或失败的 SOAP 请求的标准方式.因此,我将使用 500 并在标准 SOAP 错误中记录错误.

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

这篇关于SOAP 和 HTTP 响应代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆