3

I'm using PHP SoapClient in order to connect to a webservice.

$this->client = new SoapClient($this->wsdl, array('trace'=>true, 'cache' => WSDL_CACHE_DISK));

I have many requests each day and sometimes i'm getting the following error exception from Soap:

SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://ws-rca.24broker.ro/?wsdl' : failed to load external entity "http://www.example.ro/?wsdl" in ...

I repeat, it's not something that happens all the time. It's happening for couple seconds.

So I wanted to check if in that moment when the error occurs, the WSDL can be accessed, so in the try/catch statement i use a file_get_contents with the above url, and it seems that WSDL is up & running because i can get the XML code, in exact moment when the error occurs.

So I tried:

  1. spoke with IT guys from the hosting company that handles the above URL; they said that their WSDL was up & running at that time
  2. checked all my server log files; nothing related to the above error except the error

Does anyone have a clue what's happening ? Thanks.

Catalin Minovici
  • 181
  • 1
  • 13

1 Answers1

3

Look into your php.ini and if:

default_socket_timeout = 0;

change it with something like:

default_socket_timeout = 300;

Also you can use this function http://php.net/manual/en/function.socket-set-timeout.php. Hope that helps.

vsergiu
  • 127
  • 1
  • 9