tags:

views:

17

answers:

1

Hi guys!

I have a question, I´m developing a web page and I communicate with a server via SOAP. my code is in php.

$client = new SoapClient(null, array("location" => "$serverpath",
                                 "uri"      => "$namespace",
                                 "style"    => SOAP_RPC,
                                 "use"      => SOAP_ENCODED ));
try
{
 $returnedValue = $client->getInfo($user);

} catch (SoapException $exception)
{

 $returnedIDValue = "Caught Soap Exception: $exception\n";

}

the problem is the following, when the SOAP services are down, I do not get any exception, the program only stops.

any suggestion? I would like to handle gracefully that case.

Thanks in advantage Alejandra

A: 

Maybe you need to catch a SoapFault instead of a SoapException?

Although it's strange, because if I don't catch the SoapFault with your code I get a fatal error: Fatal error: Uncaught SoapFault exception: [HTTP] Unable to parse URL in... Stack trace: #0 [internal function]: SoapClient->__doRequest('

Replacing the SoapException with SoapFault fixes this error.

If you don't get the error, check that you have error_reporting at E_ALL in PHP configuration.

Indrek
Thanks a lot for your answer and for your time, that worked!! Regards from Guadalajara Mexico :)
Alejandra