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:
- Set
soap.wsdl_cache_enabled = 0
in php.ini - 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.) - Set
soap.wsdl_cache_enabled = 1
in php.ini - 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
New Limit Within PHP: 1000 Fields Per Post. Does Someone Know, If the Number Can Be Influenced
Get the Latest File Addition in a Directory
Manipulate an Archive in Memory with PHP (Without Creating a Temporary File on Disk)
PHP Link to Image File Outside Default Web Directory
Hide Shipping Methods for Specific Shipping Class in Woocommerce
Preg_Match(); - Unknown Modifier '+'
Setting Value of a HTML Form Textarea
Jquery Ajax Form Using Mail() PHP Script Sends Email, But Post Data from HTML Form Is Undefined
PHP Function to Get Mp3 Duration
Create a Comma-Separated String from a Single Column of an Array of Objects
PHP Remove Duplicate Values from Multidimensional Array
How to Type Hint More Than One Type
Add Columns to Admin Orders List in Woocommerce
New Lines (\R\N) Are Not Working in Email Body
How to Check If Curl Is Enabled or Disabled
Mysqli Error: User Already Has More Than 'Max_User_Connections' Active Connections