2011-12-06 11 views
1

Zendフレームワークを使用してsoapクライアントファイルを書き換えます。ハイフンでメソッドを呼び出すZend soapコール

これは古い方法です。それは働いている。

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 

どのように修正しましたか?私を助けてください。

答えて

1

strange。それはうまくいくはずです。それはZFフレームワークのバグかもしれません。おそらく関数名を変数付きのラクダの関数名に変換しようとしています。

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

を呼び出すことによって直接魔法の機能を使用してみてください

関連する問題