简体   繁体   English

Zend_XmlRpc参数故障

[英]Zend_XmlRpc parameter trouble

I'm trying to get a simple client/server XMLRPC server setup but I am having trouble using parameters. 我正在尝试获取简单的客户端/服务器XMLRPC服务器设置,但是在使用参数时遇到了麻烦。 The code runs fine if I take the $client_id parameter out of the fetchClient() method and $client->call() . 如果我从fetchClient()方法和$ client-> call()中取出$ client_id参数,则代码可以正常运行。 However if I include it, the server returns " Calling parameters do not match signature " 但是,如果包含它,服务器将返回“ 调用参数与签名不匹配

Controller Code: 控制器代码:

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: App / Service / Customer.php:

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

Client Testing Code: 客户端测试代码:

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

Any ideas? 有任何想法吗?

Disregard. 漠视。 I figured out the correct parameter to input: 我找出了正确的参数来输入:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM