I've created a gateway which receives a POST from cUrl on one system which is a well-formed XML string. After processing the gateway sends back a response XML. All the fields in the XML are required and while the system sending the data constructs the XML itself I'm running some validation to make sure that every value that's being stored in the Request Class is actually.

One thing my gateway does is that the response can also indicate an error and sends a message and response code which is then displaced on the system as the following message:

An unknown error occurred while processing. Code: # Message: ERROR_MESSAGE

The original code just sends Code as 0 if there was no error or 1 if there was. I'm thinking of giving Code another value depending on the error since displaying Code in the error message is kinda useless if it's only ever going to be 1 (since you'll never see 0). So I'm wondering if there is a standard for creating error codes, particularly with PHP and XML.

1 Answer 1


I am not aware of any specific standard that could help you.

However, there are standard protocols to pass data on the web.

  1. SOAP has a concept of soap fault

    The SOAP Fault Element

    The optional SOAP Fault element is used to indicate error messages.

  2. REST generally uses HTTP error codes. Here is an example list to show you how it could be done.

I would strongly advise you to adopt an open standards for your gateway and conform to known patterns. After all, gateways are meant to be shared resources...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.