Fault
In the event of an error, the
Body
element will include a
Fault
element. The fault subelements are defined
in Table 3-1 and include the
faultCode
, faultString
,
faultActor
, and detail
elements. Predefined SOAP fault codes are defined in Table 3-2. The following code is a sample
Fault
. The client has requested a method named
ValidateCreditCard
, but the service does not
support such a method. This represents a client request error, and
the server returns the following SOAP response:
<?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode> <faultstring xsi:type="xsd:string"> Failed to locate method (ValidateCreditCard) in class (examplesCreditCard) at /usr/local/ActivePerl-5.6/lib/ site_perl/5.6.0/SOAP/Lite.pm line 1555. </faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Element name |
Description |
|
A text code used to indicate a class of errors. See Table 3-2 for a listing of predefined fault codes. |
|
A human-readable explanation of the error. |
|
A text string indicating who caused the fault. This is useful if the SOAP message travels through several nodes in the SOAP message path, and the client needs to know which node caused the ... |
Get Web Services Essentials 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.