ZF2 SOAP “Procedure not present” Error

倖福魔咒の 提交于 2019-12-06 03:02:48

问题


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?


回答1:


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




回答2:


Also try to do the below changes and then check if it works:

  1. Remove the files starting with "wsdl-" in the tmp folder of your zend server.
  2. Make a php setting: phpSettings.soap.wsdl_cache_enabled = 0 in your application.ini file.


来源:https://stackoverflow.com/questions/16308020/zf2-soap-procedure-not-present-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!