2009-11-19 94 views
1

我想获得一个简单的客户端/服务器XMLRPC服务器设置,但我在使用参数时遇到了问题。如果我将$ client_id参数从fetchClient()方法和$ client-> call()中取出,代码运行良好。但是,如果我有它,服务器返回 “调用参数不匹配的签名Zend_XmlRpc参数问题

控制器代码:

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(); 
    } 
} 

应用程序/服务/ 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); 

任何想法?

回答

1

无视。我想出了正确的输入参数:

echo $client->call('customer.fetchCustomer', array(array('client_id' => 1)));