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...)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…