的this questionZend的Soap服務器使用WSDL自動發現預期
我試圖創建WSDL自動搜索模式Zend_Soap_Server Web服務複製不工作,但我得到很奇怪的效果......這裏的代碼: 服務器:
<?php
require_once('Zend/Soap/AutoDiscover.php');
require_once('Zend/Soap/Server.php');
require_once('Zend/Soap/Wsdl.php');
require_once('library/SoapActions.php');
$wsdl = new Zend_Soap_Autodiscover();
$wsdl->setClass('SoapActions');
if (isset($_GET['wsdl'])) {
$wsdl->handle();
} else {
$server = new Zend_Soap_Server('http://localhost:8083/server.php?wsdl');
$server->setClass('SoapActions');
$server->setEncoding('ISO-8859-1');
$server->handle();
}
SoapActions類:
class SoapActions {
/**
* Test function
*
* @param String $a
* @param String $b
* @return String
*/
public function test1($a, $b) {
return "you passed me ".$a." ".$b;
}
/**
* Test function 2
*
* @param String $a
* @param String $b
* @return String
*/
public function test2($a, $b) {
return "you passed me ".$a." ".$b;
}
}
我試圖使用功能測試1和測試2使用Zend_Soap_Client類,這裏的代碼:
require_once('Zend/Soap/Client.php');
$client = new Zend_Soap_Client("http://localhost:8083/server.php?wsdl");
try {
echo $client->test2("foo","bar"); //this works!
} catch (Exception $e) {
echo $e;
}
try {
echo $client->test1("foo","bar"); //this doesn't work!
} catch (Exception $e) {
echo $e;
}
我無法理解,因爲test2的功能正常工作,在TEST1函數返回以下異常:
的SOAPFault異常:[發件人]功能 (「測試1」)是不 /usr/local/zend/share/ZendFramework/library/Zend/Soap/Client.php:1121 棧 此服務的有效方法跟蹤: 0/usr /local/zend/share/ZendFramework/library/Zend/Soap/Client.php(1121): SoapClient - > __ soapCall('test1',Array, NULL,NULL,Array) 1/usr/local/zend /的apache2/htdocs中/ web服務/ client.php(6): Zend_Soap_Client - > __呼叫( 'TEST1', 陣列) 2 /usr/local/zend/apache2/htdocs/webservice/client.php(6): Zend_Soap_Client - > TEST1( '富', '棒') {3}主
我試圖反轉功能名稱...結果是令人難以置信的,只能test2的!我越來越瘋狂,似乎在服務器端的某個地方保存了函數名...
有人能幫助我嗎?
聖$#T I從來沒有發現。 – 2013-04-01 15:48:09