I am calling some web services using SoapClient . I am looking for a mechanism to help me display some errors for the user when web services go offline or down.
How should I wait a while (15 seconds) before showing any errors to the user. I am adding connection_timeout to a SoapClient , like this, for a timeout.
$this->client = new SoapClient($clienturl,array('trace' => 1, 'exceptions'=> 1, 'connection_timeout'=> 15));
Also at the top of the page I added this line,
ini_set("default_socket_timeout", 15);
After a certain period of time, I get different SOAP-ERROR like this,
SOAP-ERROR: Parsing WSDL: Couldn't load from $clienturl
So, I'm looking for an error handler that will handle these SOAP-ERROR to display those that are available in a human-readable format, for example, "Server is down, try again after a while." Or is there a way to handle timeout errors?
source share