Question

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?

Was it helpful?

Solution

Disregard. I figured out the correct parameter to input:

echo $client->call('customer.fetchCustomer', array(array('client_id' => 1)));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top