Search code examples
php.netiisweb-servicesnusoap

Nusoap not throwing exception when my Webservice is down


I have a Php application running on my "Server A" that consumes a .NET Web Service hosted on my "Server B". For some reason sometimes the IIS on my "B Server" fails to respond and on my Php web application takes exactly 60 seconds to load the page where the webservice call is. I want to be able to change those 60 seconds because is too long for my clients to wait. Also If there is a way to catch some kind of exception it would be great.

I tried something like this but NuSOAP is not throwing any exceptions if the web service does not respond:

 try {
     return $client->call("GetTopSellersFromCategory", $params);
 }
 catch (Exception $ex) {
      return "error";
 }

Thanks in advance for any help you can give me


Solution

  • Looking for another solution to this problem I've found this http://phptoys.com/e107_plugins/content/content.php?content.41

    I simply use that function to check if my webserver is running before calling the webmethods on my webservice. If is running then the SOAP call is made (with NuSOAP) if is DOWN then do the work around... But you can always adjust the timeout parameter on the fsockopen function to make it quicker for your application to serve the page.