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 occurred. 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
Spread the love

7 thoughts on “PHP Soap Server – Procedure not present”

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

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

      Reply
  2. Great advice. A change in the namespace was my problem too. Request was not matching WSDL’s namespace (one had ip address and the other one had a hostname).

    Reply
  3. Thanks, great post. In my case I had copied code from another class, but neglected to change the URL in the constructor of SoapServer, so it was still refering to the old WSDL.

    Reply

Leave a comment