wcf - 我的 WCF 网络服务应该返回 500 还是 200 http 代码( SOAP 故障/功能返回消息)

标签 wcf http soap

阅读 SOAP 1.1 规范后,它指出当通信通过 http 绑定(bind)时,SOAP 错误应该返回 http 500 错误代码,因此当抛出 SoapException 时,WCF 返回 http 500 错误代码。

现在,我正在寻找一些关于何时返回功能性 soap 错误消息以及何时返回 SOAP 错误的最佳实践。

如果由于输入消息包含一些功能错误、500 SOAP Fault 或包含一些错误消息的 200 Soap 响应而在处理消息时发生功能错误,你们会返回什么?

最佳答案

http://www.ws-i.org/Profiles/BasicProfile-1.1-2006-04-10.html#HTTP_Server_Error_Status_Codes :

3.4.7 HTTP Server Error Status Codes

HTTP uses the 5xx series of status codes to indicate failure due to a server error.

R1126: An INSTANCE MUST return a "500 Internal Server Error" HTTP status code if the response envelope is a Fault.

关于wcf - 我的 WCF 网络服务应该返回 500 还是 200 http 代码( SOAP 故障/功能返回消息),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2735511/

相关文章:

javascript - IE 缓存 WCF 结果 - 我可以以某种方式解决这个问题吗?

http ://mysite. com 与 http ://www. mysite.com 的 JavaScript 问题

Regex JSON 响应 Gatling 压力工具

java - Apache cxf 无法发送 MULTIPART_BOUNDARY 数据

java - 如何正确捕获 ClientTransportException

c# - WCF Restful返回HttpResponseMessage想在设置内容时进行协商

asp.net - jQuery、WCF 和 ASP.NET

architecture - OData 是否仅用作向其他方发布数据的方式,或者我可以将其用作我的应用程序的数据层吗

javascript - 使用 javascript 或 php 在所有子域的链接中将 Https 更改为 Http

java - 轴相机 wsdl