문제

I'm trying to get a simple client/server XMLRPC server setup but I am having trouble using parameters. The code runs fine if I take the $client_id parameter out of the fetchClient() method and $client->call(). 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:

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 ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top