WSFault Object encapsulates the information related to SOAP Fault and stores them as properties of the WSFault object.
WSFault object has the following properties.
Reason, Code, Detail and Role. In addition it has a property "str" which contains the entire Fault xml as a string.
So Obtaining the Fault and Getting Information from it is very simple.
All what is required it to catch the exception object, check whether it is actually a WSFault object, and read the fault properties.
For example, to obtain the Soap Fault Reason , one can use the following code sample.
try{
// Some WSClient related code goes here.
}catch (Exception $e) {
if ($e instanceof WSFault) {
printf("Soap Fault: %s\n", $e->Reason);
} else {
printf("Message = %s\n",$e->getMessage());
}
}
Read documentation from full detail.
No comments:
Post a Comment