在 cXML 中返回不同的状态码我还必须发送回 HTTP 状态码吗?
Returning different statuscode in cXML must I also send HTTP Statuscode back?
在 CXML 中,如果发件人凭据不正确,那么在我的 cxml 中,我将其作为响应发送回 cXML 的发件人 post:
<Status code="401" text="Unauthorized ">Credentials provided in the Request (the Sender element) were not recognized by the server.</Status>
根据 cXML,这是正确的。但是我是否还需要将我的 HTTP 状态代码更改为 401,或者 200 OK 就足够了吗?
正如在 cxml User Guide cxml 错误处理位于 http(传输层)错误消息之上所提到的,您可以将它们视为功能性错误,因此您仍然会回复 HTTP 200
3.1.9.1 Status
Because cXML is layered above HTTP in most cases, many errors (such as
HTTP 404/Not Found) are handled by the transport. All transport errors
should be treated as transient and the client should retry, as if a
cXML 500 range status code had been received. All HTTP replies that
don’t include valid cXML content, including HTTP 404/Not found and
HTTP 500/Internal Server Error status codes, are considered transport
errors. Other common transport problems include timeouts, TCP errors
(such as “connection refused”), and DNS errors (such as “host
unknown”). Validation errors in parsing a Request document would
normally result in a cXML permanent error in the 400 range, preferably
406/Not Acceptable.
在您的情况下,您想回复
- HTTP 200 / 确定回答
- cXML 401/未经授权
在 CXML 中,如果发件人凭据不正确,那么在我的 cxml 中,我将其作为响应发送回 cXML 的发件人 post:
<Status code="401" text="Unauthorized ">Credentials provided in the Request (the Sender element) were not recognized by the server.</Status>
根据 cXML,这是正确的。但是我是否还需要将我的 HTTP 状态代码更改为 401,或者 200 OK 就足够了吗?
正如在 cxml User Guide cxml 错误处理位于 http(传输层)错误消息之上所提到的,您可以将它们视为功能性错误,因此您仍然会回复 HTTP 200
3.1.9.1 Status
Because cXML is layered above HTTP in most cases, many errors (such as HTTP 404/Not Found) are handled by the transport. All transport errors should be treated as transient and the client should retry, as if a cXML 500 range status code had been received. All HTTP replies that don’t include valid cXML content, including HTTP 404/Not found and HTTP 500/Internal Server Error status codes, are considered transport errors. Other common transport problems include timeouts, TCP errors (such as “connection refused”), and DNS errors (such as “host unknown”). Validation errors in parsing a Request document would normally result in a cXML permanent error in the 400 range, preferably 406/Not Acceptable.
在您的情况下,您想回复
- HTTP 200 / 确定回答
- cXML 401/未经授权