还必须在cXML中返回不同的状态代码吗,我还必须发送HTTP状态代码吗? [英] Returning different statuscode in cXML must I also send HTTP Statuscode back?

查看:111
本文介绍了还必须在cXML中返回不同的状态代码吗,我还必须发送HTTP状态代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在CXML中,如果发件人凭据不正确,则在我的cxml中,我将其作为响应发送回cXML帖子的发件人:

In CXML if the Sender credentials was not correct then in my cxml I send this as a response back to the sender of the 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就足够了?

According to cXML this is correct. But do I also need to change my HTTP statuscode to 401 or will 200 OK suffice?

推荐答案

cxml用户指南 cxml错误处理位于http(传输层)错误消息的顶部,您可以将其视为功能错误,因此仍然可以使用HTTP 200进行回复

As It is mentioned in the cxml User Guide cxml error handling is on top of http (transport layer) error message, you can see them as functional errors so you still reply with an HTTP 200

3.1.9.1状态

3.1.9.1 Status

由于在大多数情况下cXML位于HTTP之上,因此会出现许多错误(例如 HTTP 404/未找到)由传输处理.所有运输错误 应该被视为暂时的,客户端应重试,就像 已收到cXML 500范围状态代码.所有HTTP回复 不包含有效的cXML内容,包括HTTP 404/未找到和 HTTP 500/内部服务器错误状态码,被视为传输 错误.其他常见的传输问题包括超时,TCP错误 (例如拒绝连接")和DNS错误(例如主机" 未知").解析请求文档时出现验证错误 通常会导致cXML永久错误在400范围内,最好 406/不可接受.

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.

在您的情况下,您希望通过以下方式回复

In your case, you want to reply with

  • HTTP 200/正确答案
  • cXML 401/未经授权

这篇关于还必须在cXML中返回不同的状态代码吗,我还必须发送HTTP状态代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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