Re: Multiple signatures

Jeff Tupholme <[email protected]> Fri, 10 Feb 2006 23:39:19 +0000
Newsgroups gmane.comp.php.xml-rpc
Message-ID <[email protected]>
Thanks for the help and sorry to be so long in replying!

I've tried calling 'system.methodSignature' with the correct (second, 
below) form of my method declaration in place, and I get the following 
back:

> &lt;br /&gt;
> &lt;b&gt;Notice&lt;/b&gt;:  Array to string conversion in 
> &lt;b&gt;/home/jeffgt/public_html/xmlrpc.inc&lt;/b&gt; on line 
> &lt;b&gt;507&lt;/b&gt;&lt;br /&gt;
> &lt;br /&gt;
> &lt;b&gt;Notice&lt;/b&gt;:  Array to string conversion in 
> &lt;b&gt;/home/jeffgt/public_html/xmlrpc.inc&lt;/b&gt; on line 
> &lt;b&gt;511&lt;/b&gt;&lt;br /&gt;
...

This of course breaks the response. The same happens if I add my method 
using add_to_map().

I appreciate I could suppress the error (via reporting levels) to make 
it work, but I'd rather fix the problem at source. Anyone seen this 
before, please? I don't see that I have any more arrays than I need!


Thanks,

Jeff


On 31 Jan 2006, at 9:17am, Gaetano Giunta wrote:

> The first example is wrong, by virtue of php syntax: you are declaring 
> twice the value of the 'signature' member of the array. The second 
> declaration wins, and the only valid signature you get is 
> $mysig2array.
>
> The second declaration looks ok to me.
> Are you sure that you are not mixing up the $mysig1array and 
> $mysig2array arrays or omitting the return type as first value of 
> $mysig1array and $mysig2array?
>
> Your best bet is to call a system.listmethods on your server, and see 
> what it declares to expose.
>
> If you upgrade to version 2.0 of the lib, you will get for free a 
> debugger (same interface as you get on 
> http://gggeek.damacom.it/debugger ) that will do the job for you, and 
> show results of the system.listmethods call in a nicely formatted 
> table - very useful for introspection!
>
> Bye
> Gaetano
>
>
>> Hi,
>>
>> I'm trying to create a method with multiple signatures and having
>> problems. I've tried both the following formats (for illustration, I
>> actually have four variants):
>>
>> $xrs = new xmlrpc_server(array(
>> 'examples.myFunc' => array(
>> 'function' => 'foo',
>> 'signature' => $mysig1array,
>> 'signature' => $mysig2array
>> )
>> ));
>>
>> $xrs = new xmlrpc_server(array(
>> 'examples.myFunc' => array(
>> 'function' => 'foo',
>> 'signature' => array($mysig1array, $mysig2array)
>> )
>> ));
>>
>> I can confirm the signature arrays themselves are OK by using them
>> one at a time. When I combine them in the first form I get an error
>> similar to:
>>
>>> Incorrect parameters passed to method: Wanted array, got string at
>>> param 2
>>
>> ... as it seems to get the various signatures confused. The second
>> form yields:
>>
>>> Incorrect parameters passed to method: No method signature matches
>>> number of parameters
>>
>> I'm using PHPXMLRPC 1.2.1 with PHP 5.1.1.
>>
>> Thanks in anticipation of any helpful suggestions.