2013-04-30 27 views
4

我很難解決這個問題。我得到了一個帶有3個模塊的APP,它們提供了不同的SOAP服務。什麼情況是,其中2收到此迴應:ZF2 SOAP「過程不存在」錯誤

的SOAPFault

文件: /var/www/empreendimentos/vendor/zendframework/zendframework/library/Zend/Soap/Client.php:10

消息: 程序不存在

我已經雙重檢查,和的函數的名稱是正確的,我使用的方法getFunctions。這是從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) 

我把手方法是這樣的:

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(); 
} 

我得到在服務器端沒有錯誤。只有這種反應的所有方法。哪裏不對?

UPDATE:

原來這是一個在ZF2配置的 「問題」。超載。我有我的modile.config.php來保存我的WSDL和URI信息,但使用相同的標籤來配置文件。重載使每個WSDL和URI都相同,並給我提出了問題。

像這樣:

的Emp模塊modile.config.php

'service_url' => array(
    "wsdl" => 'http://localhost/empreendimentos/public/emp/service?wsdl', 
    "return" => 'http://localhost/empreendimentos/public/emp/service', 
), 

的Emp模塊modile.config.php

'service_url' => array(
"wsdl" => 'http://localhost/empreendimentos/public/cli/service?wsdl', 
"return" => 'http://localhost/empreendimentos/public/cli/service', 
), 

任何人都知道這是爲什麼這樣呢?它是否包含混合模塊配置?

回答

1

昨天有這個問題,發現答案是在服務器wsdl調用。

服務器調用自己的wsdl來反思可用的方法。如果您的wsdl網址錯誤,它會查看另一臺服務器中有哪些方法可用,並說'過程不存在'。

在我的情況下AdmintoolsController有行

$wsdl_url = 'http://' . $_SERVER['HTTP_HOST'] . '/news/?wsdl'; 

所以一直在尋找的新聞服務的方法。

將其更改爲

$wsdl_url = 'http://' . $_SERVER['HTTP_HOST'] . '/admintools/?wsdl'; 

,它工作正常。

我搜索了Google幾個小時尋找這個修復程序,我的同事看了看代碼,馬上發現了它。

希望這有助於

約翰

+0

剛纔發生了什麼,我broh!非常感謝!它現在工作得很好! – 2013-05-02 17:57:05

0

也試着做下面的更改,然後檢查是否正常工作:

  1. 與「WSDL到」在刪除文件開始tmp您的zend服務器的文件夾。
  2. 使你的application.ini文件中的php設置爲:phpSettings.soap.wsdl_cache_enabled = 0