Jump to content

Speed Up Soap Request


chronister

Recommended Posts

Hiya folks,

 

I am making soap requests to a giftcard company. Here is the function I use.

 

   

<?php
function ActivateCard($CardNumber, $Amount)
  	{
        	    $client = new SoapClient(CLIENT, array('trace' => 1));
		$input = array
		(
			'TerminalID' => TID, // constant set outside of var
			'ProgramType' => ProgramType, //constant set outside of var
			'CardNumber' => $CardNumber,
			'Amount' => $Amount,
			'ServerID' => ServerId, // constant set outside of var
			'Identifier' => Identifier // constant set outside of var
		);
		$trans = $client->ActivateCard($input); // make request
		$data = $trans->ActivateCardResult;  // get response
			if(Identifier == $data->Identifier)
			{      // if these match, then they gave us back what we gave them
				$response = $data;
			}
			else
			{
				//Set a response error, codes did not match
				$response = 'Security error, transaction has been terminated';
			} 
             return $response;
	}
           ?>

 

I am trying to speed this up. This may run in a loop for a variable number of times, probably less than 20 (typically not more than 5 or so I imagine) at about 5-8 seconds per card, this could be pretty long.  I have already added

 

<?php

ini_set('soap.wsdl_cache_enabled',"1"); // enable wdsl caching
ini_set('soap.wsdl_cache_dir',$_SERVER['DOCUMENT_ROOT'].'/tmp'); // set it's tmp var
ini_set('soap.wsdl_cache_ttl',86400); // renew it each day

?>

 

and verified it is on my server now... but still takes like 6 seconds.. how can I store all transactions and make 1 request with it, is this possible?

 

I have tried passing the card num & value in corresponding arrays and that did not work. the CardNumber and Amount values it is expecting cannot be arrays.

 

Any ideas on speeding this up, or making all the calls in 1 shot rather than independently? Or am I at the mercy of their system and what they wrote it to accept in terms of the request being made?

 

Thanks,

 

Nate

Link to comment
https://forums.phpfreaks.com/topic/115767-speed-up-soap-request/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.