2

I've a php script that connects to a webservice.

When running the same script through the CLI it runs fine (initial connection a second and calls to the service very quick).

When running the page in PHP via an IIS FastCGI server it takes around 5 seconds delay on the first call to a webservice method.

The second call to the webservice method is fast as normal.

Any advice on where to check next would be appreciated. I'm at a loss of how to debug further.

I'm using PHP 5.6.13 on IIS Within Windows Server 2008 R2 Standard

This is the script i'm using to test this problem in isolation (webservice name anonymised as it's not publically accessible)

<?php 
define('SOAP_URL', 'https://sandbox.webservice.com/Service.asmx?WSDL');
define('SOAP_NAMESPACE', 'http://service.webservice.com/');

class WebService
{
  public $client;

  function __construct($SoapURL = SOAP_URL, $SoapNS = SOAP_NAMESPACE)
  {
    $soapHeader = array('User' => '...', 'SecretKey'=> '...');
    $this->client = new SoapClient($SoapURL, ['trace'=>true]);
    $header = new SOAPHeader($SoapNS, 'ClientAuth', $soapHeader);
    $this->client->__setSoapHeaders($header);
  }
}

var_dump(['start', $time = time()]);
$service = new WebService();
var_dump(['init', time() - $time]);
$params = [
    'option' => 1000,
...
    'loads_of_options_skipped' => 1,
];

$service->client->GetInfo(['for_id'=>34]);

var_dump(['call1', time() - $time]);

$service->client->GetInfo(['for_id'=>34]);

var_dump(['call2', time() - $time]);

The ouput shows a delay of 4/5 seconds on the output of "call1".

this delay doesn't occur if I run the identical script via the CLI, nor on our old webserver which was php 5.4

  • Show us the script. – Konrad Gajewski Sep 25 '15 at 12:16
  • This issue isn't related to SOAP, as I've just came across the same issue with file_get_contents opening a url. There appears to be a delay in the connection somewhere. I have no idea why this would occur in IIS but not at the command line (running git bash on windows) – Bill Wilson Sep 26 '15 at 11:57

1 Answers1

1

This issue isn't related to SOAP, as I've just came across the same issue with file_get_contents opening a url. There appears to be a delay in the connection somewhere. I have no idea why this would occur in IIS but not at the command line (running git bash on windows)