I'm having serious trouble to solve this issue. I got an APP with 3 modules that got different services to provide by SOAP. What happens is that 2 of them are getting this response:
SoapFault
File: /var/www/empreendimentos/vendor/zendframework/zendframework/library/Zend/Soap/Client.php:10
Message: Procedure not present
I already double checked, and the names of the functions are right and I use the method getFunctions. This is the return from getFunctions():
array
0 => string 'Array getCliAll(anyType $filter)' (length=32)
1 => string 'Array insertCli(anyType $data)' (length=30)
2 => string 'Array editCli(anyType $data, anyType $id)' (length=41)
3 => string 'void setServiceLocator(anyType $serviceLocator)' (length=47)
4 => string 'void getServiceLocator()' (length=24)
My handle methods look like this:
public function handleWSDL() {
$autodiscover = new AutoDiscover();
$autodiscover->setClass('\Cli\Service\CliService');
$autodiscover->setUri($this->_URI);
$wsdl = $autodiscover->generate();
$wsdl = $wsdl->toDomDocument();
// geramos o XML dando um echo no $wsdl->saveXML()
echo $wsdl->saveXML();
}
public function handleSOAP() {
$soap = new \Zend\Soap\Server($this->_WSDL_URI);
$soap->setWSDLCache(false);
$classHandle = new CliService();
$classHandle->setServiceLocator($this->getServiceLocator());
$soap->setClass($classHandle);
$soap->handle();
}
I get no errors on the server side. Only this response for all the methods. What is wrong?
UPDATE:
Turns out it's a "Problem" of the ZF2 config. overload. I had my modile.config.php to hold my WSDL and URI information, but used the same label for the config on the file. The overload was making every WSDL and URI the same, and giving me the problem.
Like this:
Emp Module modile.config.php
'service_url' => array(
"wsdl" => 'http://localhost/empreendimentos/public/emp/service?wsdl',
"return" => 'http://localhost/empreendimentos/public/emp/service',
),
Emp Module modile.config.php
'service_url' => array(
"wsdl" => 'http://localhost/empreendimentos/public/cli/service?wsdl',
"return" => 'http://localhost/empreendimentos/public/cli/service',
),
Anyone know why this is like this? is it suposed to mix module configs?
Had this problem yesterday, found the answer was in the server wsdl call.
The server calls its own wsdl to introspect the available methods. If your wsdl url is wrong, it sees what methods are available in another server and says 'Procedure not present'.
In my case the AdmintoolsController had the line
$wsdl_url = 'http://' . $_SERVER['HTTP_HOST'] . '/news/?wsdl';
so it was looking in the News service for the method.
Change it to
$wsdl_url = 'http://' . $_SERVER['HTTP_HOST'] . '/admintools/?wsdl';
and it works fine.
I searched Google for hours looking for this fix, and my colleague looked at the code and spotted it straight away.
Hope this helps
John
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