Matt.com
unread,Mar 26, 2012, 9:48:34 AM3/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Professional PHP Developers
I've been having this issue for awhile now, and I've decided it needs
to be addressed.
I'm writing a web service client using SOAP on a linux server running
PHP 5.3.6.
This web service is called from a cron job that runs continuously.
From time to time the server that hosts the WDSL will go down, at
which point the script aborts due to the "fatal" error of not being
able to load the WSDL.
I've searched the PHP forums for workarounds (yes, I have my
SoapClient instantiation inside of a try-catch block; yes, I've tried
suppressing the error using the @ symbol), to no avail. They just say
that this isn't a bug - PHP just doesn't catch fatal errors (why it's
a fatal error in the first place is beyond me).
If anyone out there has a workaround for this problem, please reply
ASAP.
Here's a snippet of my relevant code:
try {
$ctx = stream_context_create(array('http' =>
array('protocol_version' => 1.0,)));
$client = null;
$client = new SoapClient([myURL], array(
"trace" => 1,
"exceptions" => 0,
"login" => [login],
"password" =>[password],
"authentication" => SOAP_AUTHENTICATION_BASIC,
"stream_context" => $ctx
));
return $client;
} catch (SoapFault $sf) {
return $this->error_out("CF001");
} catch (Exception $e) {
return $this->error_out('CF001');
}