A WCF message exchange session consists of three types of messages.
I'll be talking about fault messages for the next two weeks. This first post is an introduction to some of the terminology used to describe faults in a SOAP messaging system. Even though there are differences in fault handling between SOAP 1.1 and SOAP 1.2, I'm not going to belabor that point. I will mostly be referring to SOAP 1.2 fault messages and you can translate those concepts into other messaging systems.
Faults come with a code that lets you programmatically determine the type of the fault. Fault codes sound a lot like error codes but are actually implemented using the model of exception types. The representation of fault codes consist of opaque strings (much like an exception namespace and type name). Creating new fault codes should be a lot like creating new exception types. It's unnecessary to create a new code for every possible fault. Instead, a new code is needed only when the client is expected to programmatically handle the fault differently than other types of fault.
The differentiator between multiple faults using the same fault code is often the fault reason. A fault reason is the human readable description of the fault. Users are unlikely to make a decision based on the fault code. Anything that could have been figured out from the fault code should have been performed automatically. Instead, users are going to read this description to understand what corrective action they should take.
The last part of a fault is the fault detail. Fault details are arbitrary content attached to the fault that the client may be able to make use of. Interpretation of the fault detail is often only possible if you know something about the particular system that generated the fault. Otherwise, the fault detail is essentially a blob that lives inside of the fault.
These three elements are part of the WCF object model for faults. Put together, these elements form the bulk of the body of a fault message. I'm going to cover the object model in more detail starting next time.
Next time: Creating Faults, Part 1