2011-12-06 125 views
1

我使用Zend框架重写肥皂客户端文件。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方法。我想要这个方法的soap调用。但发生了以下错误。因为方法名称有连字符。

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 

我是如何修复它的。请帮帮我。

回答

1

很奇怪。这应该工作。它可能是ZF框架中的一个bug。也许它试图将函数名称转换为带变量的驼峰函数名称。

$this->_client->__call('list-all', array('param1' => $param1)) 

尝试直接拨打使用的神奇功能