Hi Luke,

yes, you're right. I thought that the framework would use reflection to gather that information, but, of course, then you don't know the types of the params (because there is no type hinting for string or integer).

Thx for your help.

Regards
        Matthias

Luke Richards schrieb:
Hi Matthias,

I think the reason get_contact isn't working is because the the Zend Server components rely on docblocks to describe the function/method parameters. I've tried the following and it seems to work.

function version() {
   return 1;
}

/**
*
* @param int $id
* @return int
*/
function get_contact($id) {
   return 42;
}

$request = new Zend_XmlRpc_Request('get_contact', array('id' => 12));

$server = new Zend_XmlRpc_Server();
$server->addFunction('get_contact');
$server->addFunction('version');
echo $server->handle($request);

Hope that helps.

Luke R

Matthias Coy wrote:
Hi there,

so this is basically my code:

<?php
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();

function version() {
    return 1;
}

function get_contact($id) {
        return 42;
}

$server = new Zend_XmlRpc_Server();
$server->addFunction('get_contact');
$server->addFunction('version');
echo $server->handle();


I use xmlrpc (http://xmlrpc-c.sourceforge.net/) to test the server, basically it's

xmlrpc http://localhost/zend_xmlrpc.php version

which returns:

Result:
Integer: 1

so far so good. But I'm unable to call the get_contact function, because it's always saying:

Error: RPC failed at server. Calling parameters do not match signature (623)

So, first thought was: maybe a broken client. So I tried the Zend_XmlRpc_Client:

<?php
require_once "Zend/Loader.php";
Zend_Loader::registerAutoload();

$client = new Zend_XmlRpc_Client('http://localhost/zend_xmlrpc.php');
echo $client->call('get_contact', array("sth"));


didn't work either. So what am I doing wrong?

I'm using Zend Framework Revision 11997 and PHP 5.2.6.

Regards
    Matthias

Reply via email to