I'm writing a SOAP application in Symfony and for all my request I'm getting an error Procedure 'getClusterName' not present
.
Strange thing is that when I create a test SOAP application in pure PHP, it works fine, but the same code in Symfony returns an error.
Another strange thing is that when in the SOAP server code I list available service functions with $server->getFunctions()
, it returns array of the service functions and getClusterName
is in that array. So the function is known to the server, but it can't call it.
When writing the service in Symfony I followed this article and here is my code:
Client:
namespace Prj\SoapBundle\Controller;
class SoapController extends Controller
{
public function indexAction()
{
$client = new \SoapClient('http://localhost/test.wsdl');
$client->getClusterName();
Server:
namespace Prj\SoapBundle\Controller;
class SoapController extends Controller
{
public function indexAction()
{
ini_set("soap.wsdl_cache_enabled", "0");
$server = new \SoapServer($this->container->getParameter('wsdl'));
$server->setClass('SoapBundle\HelloService');
$server->handle();
Service:
namespace Prj\SoapBundle;
class HelloService
{
public function getClusterName()
{
return '<?xml version="1.0" encoding="utf-8"?><root>Hello!</root>';
}
}
*.wsdl file seems to be correct because it binds the call with controller and works fine with vanilla PHP service.
On Internet this error usually explained by cached wsdl, but this is handled here in server code by setting soap.wsdl_cache_enabled
parameter to zero.
Even if setting soap.wsdl_cache_enabled = 0
, try also emptying the /tmp
folder.
Clearing the tmp folder of wsdl- prefixed files worked for me. I also changed PHP's wsdl_cache_enabled option to 0 as suggested in my dev environment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With