PHP5 webservice and procedure not found / function not found problems
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!
Related posts:
- Strange issue with site – DNS may be.. We shifted servers a few days back, but we seem...
- Setting up local copy of PHP manual – with smart lookups If you are a PHP developer, you probably know that...
- Collaborating in web application using SVN What would you do if you wanted to manage document...
- Recursively unlock files on Mac OS X I copied some songs from a CD and ended up...

Thank you so much, i had exactly the same damn problem
Alexander Beck
27 Apr 07 at 3:00 pm
[...] Procedure not found / Function not found problems [...]
Flash, Flex & Web service problems at Entrepreneur Geek
7 Sep 07 at 7:51 pm
Nice one ! Almost spent hours on that !
Chris Barnes
12 Aug 08 at 4:54 am
Thanks a lot! I broke my mind trying to find solution!:)
Loki
30 Sep 08 at 4:00 pm
THY! Spent over one hour for solving this problem!
Spark
4 Nov 08 at 8:37 pm
Thanks..i’ve only spent 3 hours…
Diego
29 Jul 09 at 10:08 pm
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″);
Chris
20 Aug 09 at 1:38 am
Had the same problem. After changing all files and functions with no result, googled and found your post. You saved me. Thanks.
Srini
17 Sep 09 at 11:33 pm