SOAP Faults

Retired Content

The Web Service Software Factory is now maintained by the community and can be found on the Service Factory site.

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Retired: November 2011

A SOAP fault is the standard mechanism used to return error information from a Web service. This is important because without a standard error representation, every application would have to invent its own representation. This would make it impossible for a generic infrastructure to distinguish between success and failure. A SOAP fault is an envelope that has a single child element in the soap:Body element. That single child element is a soap:Fault element. The WS-I Basic Profile version 1.1 restricts the content of the soap:Fault element to those elements explicitly described in SOAP 1.1 (shown in the table below).

SOAP Fault Element

Description

faultcode

The faultcode element is intended for use by software to provide an algorithmic mechanism for identifying the fault. The faultcode must be present in a SOAP Fault element, and the faultcode value must be a qualified name. SOAP defines a small set of SOAP fault codes that covers basic SOAP faults.

faultstring

The faultstring element is intended to provide a human-readable explanation of the fault and is not intended for algorithmic processing. It must be present in a SOAP Fault element, and it should provide at least some information that explains the nature of the fault.

faultactor

The faultactor element is intended to provide information about who caused the fault to happen within the message path. It is similar to the SOAP actor attribute, but instead of indicating the destination of the header entry, it indicates the source of the fault. The value of the faultactor attribute is a URI that identifies the source. Applications that do not act as the ultimate destination of the SOAP message must include the faultactor element in a SOAP Fault element. The ultimate destination of a message might use the faultactor element to explicitly indicate that it generated the fault.

detail

The detail element is intended for carrying application-specific error information related to the Body element. It must be present if the contents of the Body element could not be successfully processed. It must not be used to carry information about error information that belongs to header entries. Detailed error information that belongs to header entries must be carried within header entries.

All immediate child elements of the detail element are referred to as detail entries, and each detail entry is encoded as an independent element within the detail element.

.NET Framework 4.5 provides a SoapFault class in the System.Runtime.Serialization.Formatters namespace, with Detail, FaultActor, FaultCode, and FaultString public properties. For more information about the SoapFault class, see the SoapFault Class description.