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.
-- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php