gosman

msg:4449237 | 8:37 am on May 4, 2012 (gmt 0) |
Bump ;)
|
gosman

msg:4451882 | 4:08 pm on May 10, 2012 (gmt 0) |
Anyone?
|
gosman

msg:4454054 | 8:40 am on May 16, 2012 (gmt 0) |
Last bump before it's off to join Experts Exchange ;)
|
enigma1

msg:4454120 | 12:42 pm on May 16, 2012 (gmt 0) |
Cache on what level? You want to cache the $body var contents? You want to cache the response, wsdl cache or what?
|
gosman

msg:4454125 | 1:08 pm on May 16, 2012 (gmt 0) |
Hi Enigma1 I want to cache the response, so basically if the same $body is requested within half an hour, the cached response is shown as opposed to making a new SOAP call.
|
enigma1

msg:4454264 | 6:25 pm on May 16, 2012 (gmt 0) |
In the nusoap library you should have a class called nusoap_wsdlcache. Here is some code // Setup the requested url $req = 'http://example.com/request.wsdl'; // Cache for half hour in the cache folder $soap_cache = new nusoap_wsdlcache('/cache', 1800); // Check if request is in cache $soap_wsdl = $soap_cache->get($req); // If not in cache make a record if(empty($soap_wsdl)) { $soap_wsdl = new wsdl($req); $soap_cache->put($soap_wsdl); } // Create the client object $soap_client = new nusoap_client($soap_wsdl, true); So if the request is already cached it won't be recreated.
|
gosman

msg:4454756 | 9:09 pm on May 17, 2012 (gmt 0) |
Hi Enigma1 I understand that but just don't understand how to change the code below to work with caching. $s = new nusoap_client('https://api.example.com/API.asmx'); $msg = $s->serializeEnvelope($body); $s -> send($msg,'https://api.example.com/API.asmx/CheckAvailability'); $response = $s->document;
|
enigma1

msg:4454946 | 10:32 am on May 18, 2012 (gmt 0) |
The 'https://api.example.com/API.asmx'is effectively what should be in the $req variable above. Otherwise each time you construct the client the code will parse the wsdl. Now for the specific response to be cached you could use a database or file and store the data. You could use a signature to reference the specific entry based on the request and retrieve it thereafter. For example: $signature = md5($msg . 'https://api.example.com/API.asmx/CheckAvailability'); which can be used as a db column or filename so you can check if present and if it is retrieve its content without doing the "send"
|
|