in Technology

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!

Write a Comment

Comment

  1. 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”);

Webmentions

  • Flash, Flex & Web service problems at Entrepreneur Geek October 6, 2010

    […] Procedure not found / Function not found problems […]

    • Related Content by Tag