阅读 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/