2

単純なクライアント/サーバーXMLRPCサーバーのセットアップを取得しようとしていますが、パラメーターの使用に問題があります。$ client_idパラメーターをfetchClient()メソッドから取り出して$ client-> call()を実行すると、コードは正常に実行されます。ただし、これを含めると、サーバーは「呼び出し元のパラメーターが署名と一致しません」を返します。

コントローラーコード:

class XmlrpcController extends Zend_Controller_Action
{
    public function init()
    {
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender();
    }

    public function indexAction()
    {
        $server = new Zend_XmlRpc_Server();
        $server->setClass('App_Service_Customer','customer');
        echo $server->handle();
    }
}

App / Service / Customer.php:

class App_Service_Customer
{
    /**
     * @param int $client_id
     * @return string
     */
    public function fetchCustomer($client_id)
    {
        return 'john doe';
    }
}

クライアントテストコード:

$client = new Zend_XmlRpc_Client('http://localhost/xmlrpc');
echo $client->call('customer.fetchCustomer', 1);

何か案は?

4

1 に答える 1

2

無視。入力する正しいパラメーターを見つけました:

echo $client->call('customer.fetchCustomer', array(array('client_id' => 1)));
于 2009-11-19T23:04:39.787 に答える