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>
According to cXML this is correct. But do I also need to change my HTTP statuscode to 401 or will 200 OK suffice?
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 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.
In your case, you want to reply with
- HTTP 200 / OK answer
- cXML 401 / Unauthorized