Re: PEAR::SOAP_Server and fsockopen() errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is an error handler function at the top of Server.php, that is probably what is causing your issues. Take a look at that code and see if you can work around it. The handler stuff is there primarily to catch errors when the handler functions are called.

Shane

Chris Coe wrote:

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.


-- PHP Soap Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux