PHP – Soap Fault

This function is useful when you like to check if the SOAP call failed, but don't like to use
exceptions. To use it you must 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). 

Returns TRUE on success or FALSE on failure. 

Code Example:
$client = new SoapClient("some.wsdl", array('exceptions' => 0));
$result = $client->SomeFunction();
if (is_soap_fault($result)) {
   trigger_error("SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})", E_USER_ERROR);

Post to Twitter Post to Digg Post to Facebook Post to Google Buzz Send Gmail

Leave a Comment

Your email address will not be published. Required fields are marked *