PEAR::SOAP_Server and fsockopen() errors

From: Date: Tue, 04 Nov 2003 03:42:42 +0000
Subject: PEAR::SOAP_Server and fsockopen() errors
Groups: php.soap 
Request: Send a blank email to php-soap+get-1142@lists.php.net to get a copy of this message
Hello everybody, I am writing some web services derived from PEAR::SOAP_Server objects, which are themselves clients to a number of other web services. These web services to which the SOAP_Server is a client are not always available all of the time, therefore I would like to check that the target machines are available before calling them. To do this, I've used a simple call to fsockopen(), like this: $foo = fsockopen($host, $port); if ($foo == false) { // not available; } else { fclose($foo); // call web service } However, when I put this code inside a class derived from SOAP_Server, when fsockopen() fails to open a socket it generates a SOAP_Fault (which is serialized and output) and exits the script. This happens even if I prepend fsockopen() with the @ symbol. If I try to skip this step and just call the service, a similar failure occurs within HTTP/Request.php when it calls fsockopen() to send the SOAP request. How can I alter the behaviour of the script so that when a socket fails to open, it just returns false as normal, so that I can do my own error processing? Any help with this appreciated! Best, Chris.

« previous php.soap (#1142) next »