PHP Soap Server - Procedure not present

While developing a PHP SOAP service, I ran across this error after doing some updates to a WSDL:
Procedure '[name]' not present
This seems to suggest a problem with the class loaded into the SOAP server, but in fact it is typically more of a problem with the WSDL. There are a number of causes for this, I've rounded up a few of them here:
 
WSDL Caching
By default PHP will cache the WSDL, which can cause problems when you update it. The fast way to deal with this is to check the temp directory for any wsdl* files and delete them (this is usually /tmp, but you can check your phpinfo to make sure). Props to Artur for posting this.
 
As a more permanent solution you can set soap.wsdl_cache_enabled in php.ini to 0. You could also set this at the start of your script with ini_set, however it may not be desirable in a production environment (particularly with a large WSDL). There is also an option when constructing the SoapServer to disable caching:
$server = new SoapServer("some.wsdl", array('cache_wsdl' => WSDL_CACHE_NONE));
Note that disabling the cache may not help if the WSDL is already cached, so see the first option once you've disabled the cache.
 
Wrong WSDL
It is possible the SOAP Server is configuring the with the wrong WSDL. This might be if you've updated the filename or if you are loading from a URL which isn't the desired one. Double check the WSDL being loaded is the correct one. (this one comes from a Stack Overflow question).
 
Wrong Namespace
This turned out to be my problem. I'd tweaked the namespace URL in the WSDL's schema but hadn't done so in the request. This mismatch meant the SOAP error occured. I had been versioning the schema namespaces while developing, but on the whole it is probably best to stick to changing the filename only.

Soap picture by David

Comments

I did all the above mentioned trick but still receive the error

Hello,
I've the same problem, I tried all the described solutions but it is still present. Anybody can helps ? Thanks

Hi,
in my case I had to add namespace to the response. Hope it helps someone.

Cheers.

Hi, be careful with namespace... it includes schema, host and port, etc. If you change https://domain.com/XXX to https://domain.com:443/XXX, this will be a different namespace...

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.