I have a question, I am 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";
}
When the SOAP services are offline, I do not get any exception; the program just stops.
Any suggestions? I would like to handle gracefully that case.
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.