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