WSDL being cached

I am having constant problems with WSDL for the Web Service being cached. I am seeing the WSDL definition, but it doesn’t include the methods I’ve defined using @soap in the function comments. Of course it all works fine in my dev environment, but as soon as I put it in a staging or live environment, the caching pain begins…

  1. I have tried using ini_set to disable different caches, ie soap.wsdl_cache_ttl, soap.wsdl_cache_enabled, eaccelerator.enable, but this didn’t work

  2. I have disabled the same options in php.ini. eaccelerator.enable=0 worked for a short time, and I got the full WSDL definition, but re-enabled it and when I came back to check it 12 hours later it is back to the cached version with no methods defined.

Can anyone think of any other ways I can get around this? I’m at the end of my tether, and about to start building a REST implementation because this SOAP stuff sucks…

You talk about a web service you created with Yii (instead of a SoapClient)? All the settings you mentioned affect the soap client WSDL cache. Did you maybe configure CWebServive::wsdlCacheDuration in your service class?

EDIT:

Sorry, just reading the code of CWebService i see, that wsdl_cache_enabled also affects the wsdl cache for SoapServer. So to be sure also ini_set() this to 0.

Try this in your controller class page:




ini_set ('soap.wsdl_cache_enabled',0);



I had the same problem. My server is a CentOS running PHP through Apache 2.0 Handler with eAccelerator enabled.

The solution I found was create a .htaccess in my application directory with the following lines:




php_flag eaccelerator.enable 0

php_flag eaccelerator.optimizer 0



Sorry, my english isn’t good.

After experiencing the same problem and looking at all the cache issues, I found the issue is actually caused by the getComments(), getMethods() methods within the PHP Reflection class.

This is used by Yii within: /web/services/CWsdlGenerator.php

This class doesn’t work with eaccelerator as it can’t access the comment data to see the @soap comments.

Instead of disabling cache, you can replace the calls to this method with the regexp mentioned in the comments at the reflectionclass PHP dot net documentation.

Since this is my first post on here, they won’t let me post the link…

I hope this helps someone else. I’m guessing this is actually a Yii bug to rely on this slightly flaky method.