I was having a discussion about this with a co-worker and we couldn't come to an agreement, so I wanted to get your thoughts. I have my own opinions on this, but I won't spoil it for you.
When should I be returning a SOAP fault and when should I be returning a result object that has error information? Assume this is for a generic web service that can be consumed by various systems (.NET, Java, whatever). The result object would have an isError flag, an errorType (similar to specific exception type), and a message.
Some points to consider:
- Is a data validation error a fault?
- Should there be a combination of faults (for very exceptional cases) and the results object (for "expected" errors)?
- How would you group SOAP faults (critical [null reference] vs validation [zip code incorrect])?
- Fail-fast vs having to remember to check for error
- Best practices, patterns, standards, etc.
Links to articles are valid. Even though it sounds like I want your opinion, please stick to facts (x is better because of y and z...)
Code
element can have valueSender
which is described asThe message... did not contain the appropriate information in order to succeed. For example, the message could lack... payment information. It is generally an indication that the message is not to be resent without change.
That seems like data validation to me and thus an indication that faults should be used. – Financier