note 91575 added to soapclient.call
| From: | KRavEN at osu1 dot php dot net | Date: | Wed, 17 Jun 2009 13:56:41 +0000 |
| Subject: | note 91575 added to soapclient.call | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156984@lists.php.net to get a copy of this message | ||
extend of __call thats adds a retry to handle the occasional 'Could not connect to host'
exceptions
<?php
class LocalSoapClient extends SoapClient
{
public function __call($function_name, $arguments)
{
$result = false;
$max_retries = 5;
$retry_count = 0;
while(! $result && $retry_count < $max_retries)
{
try
{
$result = parent::__call($function_name, $arguments);
}
catch(SoapFault $fault)
{
if($fault->faultstring != 'Could not connect to host')
{
throw $fault;
}
}
sleep(1);
$retry_count ++;
}
if($retry_count == $max_retries)
{
throw new SoapFault('Could not connect to host after 5 attempts');
}
return $result;
}
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 192.193.221.141
----
Manual Page -- http://www.php.net/manual/en/soapclient.call.php
Edit -- https://master.php.net/note/edit/91575
Del: integrated -- https://master.php.net/note/delete/91575/integrated
Del: useless -- https://master.php.net/note/delete/91575/useless
Del: bad code -- https://master.php.net/note/delete/91575/bad+code
Del: spam -- https://master.php.net/note/delete/91575/spam
Del: non-english -- https://master.php.net/note/delete/91575/non-english
Del: in docs -- https://master.php.net/note/delete/91575/in+docs
Del: other reasons-- https://master.php.net/note/delete/91575
Reject -- https://master.php.net/note/reject/91575
Search -- https://master.php.net/manage/user-notes.php