98

In through php_info() where the WSDL cache is held (/tmp), but I don't necessarily know if it is safe to delete all files starting with WSDL.

Yes, I should be able to just delete everything from /tmp, but I don't know what else this could effect if I delete any all WSDL files.

7ochem
  • 2,183
  • 1
  • 34
  • 42
jW.
  • 9,280
  • 12
  • 46
  • 50

6 Answers6

208

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) );
Brock Adams
  • 90,639
  • 22
  • 233
  • 295
Owen
  • 82,995
  • 21
  • 120
  • 115
  • 32
    I believe that when using SoapClient, instead of hardcoding a 0, it is recommended that you use the defined constant WSDL_CACHE_NONE. See http://php.net/manual/en/soapclient.soapclient.php – Dan Burton Jul 22 '10 at 20:09
  • Anyway I can let the caching funtionality as it is but some how invalidate all cache for a time being? We can do these things easily in .net e.t.c. – Kamran Shahid Jan 07 '15 at 13:49
  • This solution do clears the cache but it is also a trade off for the performance. – Nabeel Arshad Jan 08 '15 at 05:35
  • 6
    For actually clearing the cache, even though the /tmp files were removed I still was getting wsdl cache issues until I used this setting `ini_set('soap.wsdl_cache_ttl', 1);` and let it sit for an hour - found here: http://stackoverflow.com/questions/323561/force-re-cache-of-wsdl-in-php – Joshua Fricke Sep 29 '16 at 17:51
30

Remove all wsdl* files in your /tmp folder on the server.

WSDL files are cached in your default location for all cache files defined in php.ini. Same location as your session files.

Machavity
  • 30,841
  • 27
  • 92
  • 100
user3259435
  • 309
  • 3
  • 3
14

if you already deployed the code or can't change any configuration, you could remove all temp files from wsdl:

rm /tmp/wsdl-*
Markomafs
  • 546
  • 4
  • 19
12

I recommend using a cache-buster in the wsdl url.

In our apps we use a SVN Revision id in the wsdl url so the client immediately knows of changing structures. This works on our app because, everytime we change the server-side, we also need to adjust the client accordingly.

$client = new SoapClient('http://somewhere.com/?wsdl&rev=$Revision$');

This requires svn to be configured properly. Not on all repositories this is enabled by default.

In case you are not responsible for both components (server,client) or you don't use SVN you may find another indicator which can be utilised as a cache-buster in your wsdl url.

staabm
  • 1,535
  • 22
  • 20
5

Just for the reason of documentation:

I have now (2014) observed that from all these valuable and correct approaches only one was successful. I've added a function to the WSDL on the server, and the client wasn't recognizing the new function.

  • Adding WSDL_CACHE_NONE to the parameters didn't help.
  • Adding the cache-buster didn't help.
  • Setting soap.wsdl_cache_enabled to the PHP ini helped.

I am now unsure if it is the combination of all three, or if some features are terribly implemented so they may remain useless randomly, or if there is some hierarchy of features not understood.

So finally, expect that you have to check all three to solve problems like these.

peter_the_oak
  • 3,529
  • 3
  • 23
  • 37
0

Edit your php.ini file, search for soap.wsdl_cache_enabled and set the value to 0

[soap]
; Enables or disables WSDL caching feature.
; http://php.net/soap.wsdl-cache-enabled
soap.wsdl_cache_enabled=0
Kiran Reddy
  • 734
  • 12
  • 28