Tuesday, May 3, 2011

PHP SoapClient times out

I'm trying to call a Soap Client for testing purposes from the same server that I'm running the service on. My WSDL is at: http://www.installittoday.com/api/server.php?wsdl I'm trying to load it simply with:


    $client = new SoapClient('http://www.installittoday.com/api/server.php?wsdl');
but I get back the error:

Warning: SoapClient::SoapClient(http://www.installittoday.com/api/server.php?wsdl) [soapclient.soapclient]: failed to open stream: Connection timed out in /home/installi/public_html/api/client.php on line 4  

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "http://www.installittoday.com/api/server.php?wsdl" in /home/installi/public_html/api/client.php on line 4  

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://www.installittoday.com/api/server.php?wsdl' : failed to load external entity "http://www.installittoday.com/api/server.php?wsdl" in /home/installi/public_html/api/client.php:4 Stack trace: #0 /home/installi/public_html/api/client.php(4): SoapClient->SoapClient('http://www.inst...') #1 {main} thrown in /home/installi/public_html/api/client.php on line 4

Yet I can set up the client just fine from another site of mine. Is this a firewall issue or what?

From stackoverflow
  • Also loading from here fine.

    Try connecting to it from the site you want the client on with a web browser, or if its a remote machine with no proxy set up use curl:

    curl http://www.installittoday.com/api/server.php?wsdl
    

    That will tell you if you can even get a connection to that site via the machine.

    You could also try multiple connects, or increasing default_socket_timeout if your machines connection speed is limited/congested.

    What ports are you trying to connect over?

  • OP again here.

    A little more context: I'm hosting the service (obviously) on installittoday.com. I'm also trying to run a client from the same place just for testing purposes. I can connect to the service from literally every other site I've tried perfectly fine, and I've successfully opened a few WSDLs with the Client hosted on installittoday. It seems the site can't connect to itself for some reason.

    I sincerely doubt it's a congested line issue.

    Now that I've gotten this far I realize this problem probably extends beyond SOAP to some kind of Apache configuration issue, unless there's a port thing that I'm missing. I haven't set up any ports differently, is there one I should make sure I have open for SOAP?

    Ciaran McNulty : SOAP runs over HTTP normally, so that shouldn't be the problem.
  • I solved this problem by saving the dynamically generated nusoap WSDL as a standalone file and all seems to be working just fine. I have no idea why this would be the case.

    I'm planning to move it to PHP5 anyway, I was just using nuSoap to generate the WSDL.

0 comments:

Post a Comment