質問

Zend Frameworkを使用して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

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

役に立ちましたか?

解決

変。それはうまくいくはずです。 ZFフレームワークのAAバグかもしれません。多分それは、変数を持つ関数名をキャメルケース関数名に変換しようとしているかもしれません。

次のように呼び出して、魔法の関数を直接使用してみてください。

$this->_client->__call('list-all', array('param1' => $param1))
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top