I was working with PHP5 webservices and had a head spinning experience because of the WSDL cache. Everything was working fine on my local setup, but when I uploaded that to the server, it said:
[faultstring] => Function ("savePrefs") is not a valid method for this service [faultcode] => Client [faultcodens] => http://schemas.xmlsoap.org/soap/envelope/ )
Another variant of this was Procedure ("savePrefs") not found
. I checked and rechecked my WSDL and Webservice files. But everything was just right. Tried changing the parameters of the function, assuming that there was some problem in the WSDL definition. That too did not work. Google’d for this, did not get much. I then did everything possible to get this to work: even recompiled PHP to the latest version on the server 😉
But then I figured that it was not accepting any new methods I add to the web service. Which meant that something was cached. Digging further, I found it was the WSDL being cached on the server side. PHP caches the WSDL file for better performance. There is no way to turn off this cache other than a php.ini setting.
So I added this line to my .htaccess file:
php_value soap.wsdl_cache_enabled 0
And it worked! 🙂
I think I can write a book about SOAP and WSDL blues now!
Thank you so much, i had exactly the same damn problem 🙂
Nice one ! Almost spent hours on that ! 🙂
Thanks a lot! I broke my mind trying to find solution!:)
THY! Spent over one hour for solving this problem!
Thanks..i’ve only spent 3 hours…
Many many thanks. The htaccess line did not work for me, I think because of my webhost. But your suggestion lead me to find this PHP code which worked for me:
ini_set(“soap.wsdl_cache_enabled”, “0”);
Had the same problem. After changing all files and functions with no result, googled and found your post. You saved me. Thanks.
Incredible. It works!!!!!! I spent a day to solve it. And decision is so simple. Be blassed, good man.
You can also add the following to your SoapClient constructor in the options array:
‘cache_wsdl’=>WSDL_CACHE_NONE