SOAP Faults
A SOAP fault is a standards-based format for transferring exceptions between applications. Recall from Chapter 2 that the SOAP specification defines a standard XML format for messages that include a header and body section. The same specification includes a definition for SOAP faults, providing structure for the contents of the message body when errors occur. This makes it possible for different technologies and platforms to provide plumbing to handle faults in a predictable manner. In most cases, this means converting the fault into some form of exception construct representative of the platform. Developers interact with the exception to deal with error conditions.
I discussed in Chapter 2 that the SOAP specification has two versions. In fact, one of the biggest differences between SOAP 1.1 and SOAP 1.2 is in the format for the SOAP fault. Not only do these specifications describe the format for faults, they also supply guidance on the contents of faults (such as error codes) and on the way platforms should process faults.
Fault Versions
SOAP 1.1 and SOAP 1.2 both define a format for faults. Though they essentially contain similar information when serialized, the naming conventions for XML elements were refactored slightly. Table 8-1 compares XML elements described by each specification and describes their purpose.
Table 8-1. Comparison of SOAP 1.1 and SOAP 1.2 elements
SOAP 1.1 |
SOAP 1.2 |
Element description |
---|---|---|
|
|
Required. Can be one of the specification’s ... |
Get Learning WCF now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.