In PHP How to Clear a Wsdl Cache

In PHP how can you clear a WSDL cache?

You can safely delete the WSDL cache files. If you wish to prevent future caching, use:

ini_set("soap.wsdl_cache_enabled", 0);

or dynamically:

$client = new SoapClient('http://somewhere.com/?wsdl', array('cache_wsdl' => WSDL_CACHE_NONE) );

Force re-cache of WSDL in php

I guess when you disable caching it will also stop writing to the cache. So when you re-enable the cache the old cached copy will still be there and valid. You could try (with caching enabled)

ini_set('soap.wsdl_cache_ttl', 1);

I put in a time-to-live of one second in because I think if you put zero in it will disable the cache entirely but not remove the entry. You probably will only want to put that line in when you want to kill the cached copy.

Purpose of php wsdl cache

As far as I know, ALL cache implementations anywhere have the purpose to improve performance. It is kind-of the definition of 'cache'.

Once the WSDL gets updated, your script will not know it indeed, until the cache expires.

The cache settings for SOAP can be set in the options parameter of the constructor, in php.ini and via de runtime configuration.

You can use the following settings for wsdl_cache, once wsdl_cache_enabled is enabled: WSDL_CACHE_NONE (0), WSDL_CACHE_DISK (1), WSDL_CACHE_MEMORY (2) or WSDL_CACHE_BOTH (3).

The cache value of 1 day is default, but can be changed in wsdl_cache_ttl.

To disable the use of caching in runtime, use the following (before creating any SOAP object):

ini_set('soap.wsdl_cache_enabled', '0');
ini_set('soap.wsdl_cache_ttl', '0')

SoapClient __soapCall calls older version of a service even after clearing the cache dir

It turned out deleting soap.wsdl_cache_dir with rm /tmp/wsdl-* wasn't enough.

Following these steps actually worked for me:

  1. Set soap.wsdl_cache_enabled = 0 in php.ini
  2. Restart httpd (After this, the exception became SOAP-ERROR: Parsing WSDL: Couldn't load from '/wsdl_947060b0c026bc9194617a747e1b22ab.cache' : failed to load external entity "/wsdl_947060b0c026bc9194617a747e1b22ab.cache". I don't know why.)
  3. Set soap.wsdl_cache_enabled = 1 in php.ini
  4. Restart httpd

Horrible caching. How to make it go away?

Per Owen's answer, you can disable WSDL caching with this which you should probably run in unit tests. I suppose it's enabled by default somewhere in an ini file or something.

ini_set("soap.wsdl_cache_enabled", 0);


Related Topics



Leave a reply



Submit