I am working on a project which relies heavily on SOAP calls. The problem is that load times a re extremely long.
$client = new SoapClient("https://link.to.wsdl");
$client = $client->GetDestination(array(
"parameter1" => $param1,
"parameter2" => $param2
));
Now I did some timing and the first part of the code(initiating an object $client) takes about 2 seconds, very acceptable. But when calling getDestination it adds about 10 seconds loading time. This is with every get or set method that I call.
This code is running on php 5. The methods are written in .net 4.x
Does anyone know why this is and how it can be solved?
EDIT: ping statistics 10 packets transmitted, 10 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 1.086/2.320/3.624/1.157 ms
First, you should enable WSDL caching using the soap.wsdl_cache_enabled
ini value or using the $options
param of the SoapClient
constructor. This would prevent PHP from downloading the wsdl again and again and will speedup the constructor (2 seconds it also very long)
To speedup the method calls itself, I need more information. Are you able to use wireshark to introspect the network communication between your app and the soap server?
I had a similar issue connecting to a SOAP service on the same machine as my code. It was resolved by using http://127.0.0.1/
instead of http://localhost/
as the url.