Entrepreneur Geek

Nirav Mehta on life, technology and future

PHP5 webservice and procedure not found / function not found problems

with 8 comments

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:

  1. Strange issue with site – DNS may be.. We shifted servers a few days back, but we seem...
  2. Setting up local copy of PHP manual – with smart lookups If you are a PHP developer, you probably know that...
  3. Collaborating in web application using SVN What would you do if you wanted to manage document...
  4. Recursively unlock files on Mac OS X I copied some songs from a CD and ended up...

Written by Nirav

January 28th, 2006 at 9:35 am

Posted in PHP

 

8 Responses to 'PHP5 webservice and procedure not found / function not found problems'

Subscribe to comments with RSS or TrackBack to 'PHP5 webservice and procedure not found / function not found problems'.

  1. Thank you so much, i had exactly the same damn problem :)

    Alexander Beck

    27 Apr 07 at 3:00 pm

  2. [...] Procedure not found / Function not found problems [...]

  3. Nice one ! Almost spent hours on that ! :-)

    Chris Barnes

    12 Aug 08 at 4:54 am

  4. Thanks a lot! I broke my mind trying to find solution!:)

    Loki

    30 Sep 08 at 4:00 pm

  5. THY! Spent over one hour for solving this problem!

    Spark

    4 Nov 08 at 8:37 pm

  6. Thanks..i’ve only spent 3 hours…

    Diego

    29 Jul 09 at 10:08 pm

  7. 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

  8. 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

Leave a Reply