SOAP Fault Message Structure

This section provides a description of the SOAP fault message structure and a sample message.

A SOAP fault message is a special SOAP message used to carry error information. It must have only one body child element called "Fault" element with the following structure:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
 <env:Header>
  ...
 </env:Header>
 <env:Body>
  <env:Fault>
   <env:Code> (required)
    <env:Value>env:VersionMismatch | env:MustUnderstand | Sender
       | DataEncodingUnknown | Receiver</env:Value> (required)
    <env:Subcode> (optional)
     <env:Value>text</env:Value> (required)
      <env:Subcode> (optional)
       ...
      </env:Subcode>
    </env:Subcode>
   </env:Code>
   <env:Reason> (required)
    <env:Text xml:lang="languageCode">text<env:Text> (required)
    <env:Text xml:lang="languageCode">text<env:Text> (opitonal)
    ...
   </env:Reason>
   <env:Node> (optional)
    http://herong.com/processingNode
   </env:Node>
   <env:Role> (optional)
    http://herong.com/processingRole
   </env:Role>
   <env:Detail ...> (optional)
    ... (any XML structure)
   </env:Detail>
  </env:Fault>
 </env:Body>
</env:Envelope>

Note that:

To give an idea of how a SOAP fault message looks like, I have copied the example #6a from the SOAP 1.2 specification here:

<?xml version='1.0' ?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
            xmlns:rpc='http://www.w3.org/2003/05/soap-rpc'>
  <env:Body>
   <env:Fault>
     <env:Code>
       <env:Value>env:Sender</env:Value>
       <env:Subcode>
        <env:Value>rpc:BadArguments</env:Value>
       </env:Subcode>
     </env:Code>
     <env:Reason>
      <env:Text xml:lang="en-US">Processing error</env:Text>
      <env:Text xml:lang="fr-CA">Error</env:Text>
     </env:Reason>
     <env:Detail>
      <e:myFaultDetails 
        xmlns:e="http://travelcompany.example.org/faults">
        <e:message>Name does not match card number</e:message>
        <e:errorcode>999</e:errorcode>
      </e:myFaultDetails>
     </env:Detail>
   </env:Fault>
 </env:Body>
</env:Envelope>

Last update: 2007.

Table of Contents

 About This Book

 Introduction to Web Service

 Introduction to SOAP (Simple Object Access Protocol)

SOAP Message Structure

 SOAP Generic Message Structure

SOAP Fault Message Structure

 SOAP Message Transmission and Processing

 SOAP Data Model

 SOAP Encoding

 SOAP RPC Presentation

 SOAP Properties Model

 SOAP Message Exchange Patterns

 SOAP HTTP Binding

 SOAP Perl Implementations

 SOAP PHP Implementations

 SOAP Java Implementations

 Perl SOAP::Lite - SOAP Server-Client Communication Module

 Perl Socket Test Program for HTTP and SOAP

 Perl SOAP::Lite for GetSpeech SOAP 1.1 Web Service

 Perl SOAP::Lite 0.710 for SOAP 1.2 Web Services

 Perl SOAP::Lite 0.710 for WSDL

 PHP SOAP Extension Client Programs

 PHP SOAP Extension Server Programs

 Java Socket and HttpURLConnection for SOAP

 SAAJ - SOAP with Attachments API for Java

 SoapUI - SOAP Web Service Testing Tool

 WS-Security - SOAP Message Security Extension

 WS-Security X.509 Certificate Token

 Web Services and SOAP Terminology

 References

 PDF Printing Version