我使用 Zend 框架重写了肥皂客户端文件。
这是老方法。这是工作。
function getBassaService(){
global $service;
$h="127.0.0.1";
$p="8000";
if($service==null){
$service = new SoapClient("/test/php/bassa.wsdl", array(
"soap_version" => SOAP_1_2,
"trace" => 1,
"exceptions" => 1,
"location" => "http://".$h.":".$p));
}
return $service;
}
function getAllDownloads(){
global $service;
$client = getService();
try{
$results = $client->__soapCall("list-all", array());
}catch(SoapFault $e){
print($e->faultstring);
}
return $result;
}
这是我的新代码。我使用 Zend_Soap_Client。
const HOST = "127.0.0.1";
const PORT = "8095";
protected $_client;
public function __construct()
{
$this->_client = new Zend_Soap_Client(APPLICATION_PATH ."/services/bassa.wsdl",
array(
"soap_version" => SOAP_1_2,
"uri" => "http://". self::HOST .":". self::PORT
)
);
}
public function getAllDownloads()
{
$result = $this->_client->list-all();
return $result;
}
我的肥皂服务器有list-all
方法。我想要对该方法的肥皂调用。但是出现了以下错误。因为方法名称有连字符。
Notice: Undefined property: Zend_Soap_Client::$list in /home/dinuka/workspace/testzend/application/services/SoapClient.php on line 57
Fatal error: Call to undefined function all() in /home/dinuka/workspace/testzend/application/services/SoapClient.php on line 57
我是如何解决的。请帮我。