Question


I have a soap services with a lot of calls.

$client = new SoapClient(null, $options); 
$result1 = $client->service($valeurs1); 
$result2 = $client->service($valeurs2); 
...
$resultn = $client->service($valeurs3); 

My problem happens if I exceed a certain number of calls, I fall in time-out.
I can increase the max_execution_time but I'm not a fan of this solution.

If I put everything in one call, it does not pass either (too much data)

$client = new SoapClient(null, $options); 
$result = $client->service($valeurs1 + $valeurs2 + .... + $valeursn); 

Is there a way to stop my service soap in the execution of my php script to recreate a new one every call?

$client1 = new SoapClient(null, $options); 
$result1 = $client1->service($valeurs1); 
// stop connection soap
$client2 = new SoapClient(null, $options); 
$result2 = $client2->service($valeurs2); 
// stop connection soap
...
$clientn = new SoapClient(null, $options); 
$resultn = $clientn->service($valeursn);
// stop connection soap

My php version is 5.3
I can not use "keep_alive" which appeared in 5.4

If you have an idea, that would be great! :)

(Sorry for my english : translate.google :))

Was it helpful?

Solution

I will make a return to close my question and all the better if it can served to someone.

Already again thank you to @IMSoP have answered me and have referrals.

The principle of my dev is updated many elements (on a real example, it can range from 1 to 12000). I had gone to make a call to each update, or the time of the call to the webservice more processing time, I passed largely the actual execution time of PHP (max_execution_time).

So I went on a different principle, I send a file to update my elements and the time is much better. :) Here is an example SOAP call with a file for those who are interested. :)

$url_base = 'http://www.exampletoto.tata/';

// SOAP Client Options
$options = array();
$options['location'] = $url_base. 'webservice/soap';
$options['uri'] = $url_base ;  
$options['encoding'] = 'ISO-8859-15';
$options['soap_version'] = SOAP_1_2;


$nom_fic = 'file_name.csv';

$handle = fopen('C:\\TMP\\' . $nom_fic, "rb");
$contents = fread($handle, filesize('C:\\TMP\\' . $nom_fic));
fclose($handle);

$info = array('nom_fic'    => $nom_fic,
              'taille_fic' => filesize('C:\\TMP\\' . $nom_fic));

$client = new SoapClient(null, $options); 
$result = $client->updateService($info, $contents); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top