O'Reilly logo

Java and SOAP by Robert Englander

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.12. SOAP Faults

The Fault is the only Body element entry defined by SOAP. It's used to carry error information back to the originator of a SOAP message. The Fault element must appear as an immediate subelement of the Body element, and it can't appear more than once.

SOAP defines four subelements of the Fault element. Not all of these are required, and some are appropriate only under certain conditions. These elements are described in the following sections. You'll probably recognize that we've seen all of these in previous examples, so you may want to flip back and look at them again after you've read these descriptions.

2.12.1. The faultcode Element

The faultcode element provides an indication of the fault that is recognizable by a software process, providing an opportunity for the system receiving the fault to act appropriately. The code is not necessarily useful to humans — that is the purpose of the faultstring element described in the next section. The faultcode element is mandatory, and must appear as a subelement of the Fault element. SOAP defines a number of fault codes for use in the faultcode element. These codes are associated with the http://schemas.xmlsoap.org/soap/envelope namespace. Here are brief descriptions of the SOAP-defined fault codes:

VersionMismatch

Indicates that an invalid namespace was associated with the SOAP Envelope.

MustUnderstand

Means that there was a SOAP Header element that contained the mustUnderstand attribute with a value ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required