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