is_soap_fault
Checks if a SOAP call has failed
&reftitle.description;
boolis_soap_fault
mixedobject
This function is useful to check if the SOAP call failed, but
without using exceptions. To use it, create a
SoapClient object with the exceptions
option set to zero or &false;.
In this case, the SOAP method will return a special
SoapFault object which encapsulates the fault
details (faultcode, faultstring, faultactor and faultdetails).
If exceptions is not set then SOAP call will throw
an exception on error.
is_soap_fault checks if the given
parameter is a SoapFault object.
&reftitle.parameters;
object
The object to test.
&reftitle.returnvalues;
This will return &true; on error, and &false; otherwise.
&reftitle.examples;
is_soap_fault example
0));
$result = $client->SomeFunction();
if (is_soap_fault($result)) {
trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);
}
?>
]]>
SOAP's standard method for error reporting is exceptions
SomeFunction(/* ... */);
} catch (SoapFault $fault) {
trigger_error("SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}
?>
]]>
&reftitle.seealso;
SoapClient::__construct
SoapFault::__construct