[phpxmlrpc] Multiple signatures

Gaetano Giunta giunta.gaetano at sea-aeroportimilano.it
Thu Feb 16 11:59:20 GMT 2006


Sorry, but the spec for system.methodSignature is quite clear on the support for multiple signatures, and the code is also a clear indication of support for multiple signatures:

(assuming lib version 1.2.1)

as far as listing signatures goes: 
in function _xmlrpcs_methodSignature(), on line 86 we loop on all the possible signatures of the given method,
and on lines 88-94 we list every single sig

as far as validating sigs goes:
in method xmlrpc_server->verifySignature(), on line 322 we loop over every available sig, on line 326 the number of parameters is checked, and on lines 331-347 the type of the single received param is validated.

To be more clear, here is an example of valid usage:

$sig1 = array ($xmlrpcI4, $xmlrpcString); // return an int, receive a string
$sig2 = array ($xmlrpcI4); // return an int, no input params

$dmap1 = array (
  'method1name' => array (
    'function' => 'foo',
    'signature' => array($sig1) // notice that I wrap $sig1 into an array!
  )
)

$dmap2 = array (
  'method1name' => array (
    'function' => 'foo',
    'signature' => array($sig1, $sig2)
  )
)

To be sure about what is going on, could you add this as line 86 of xmlrpcs.inc:
var_dump($thesigs);
and mail back the results?

Bye
Gaetano

> -----Original Message-----
> From: phpxmlrpc-bounces at lists.usefulinc.com
> [mailto:phpxmlrpc-bounces at lists.usefulinc.com]On Behalf Of 
> Jeff Tupholme
> Sent: Tuesday, February 14, 2006 11:13 AM
> To: <phpxmlrpc at lists.usefulinc.com> <phpxmlrpc at lists.usefulinc.com>
> Subject: Re: [phpxmlrpc] Multiple signatures
> 
> 
> 
> Thanks. I agree, but $mysig1array and $mysig2array are just regular 
> arrays. At the moment I use one of them as my (single) 
> signature, so I 
> know it works.
> 
>  From a quick look at the code it seems that 'system.methodSignature' 
> doesn't (yet) support multiple signatures. That makes it hard 
> to debug 
> them!
> 
> (Again, I'm working with 1.2.1 and this may already be fixed in 2.0)
> 
> 
> Jeff
> 
> 
> On 13 Feb 2006, at 11:41pm, Gaetano Giunta wrote:
> 
> > BTW:
> > the method sig must be an array of arrays, wheter you have only one 
> > valid sig or more.
> >
> > If, in your code,
> >
> >
> >>>>> $xrs = new xmlrpc_server(array(
> >>>>> 'examples.myFunc' => array(
> >>>>> 'function' => 'foo',
> >>>>> 'signature' => array($mysig1array, $mysig2array)
> >>>>> )
> >>>>> ));
> >
> > mysigarray1 and mysigarray2 are already both an array of 
> array, I see 
> > how this could generate a warning.
> >
> > maybe
> > you could try with:
> > 'signature' => array($mysig1array[0], $mysig2array[0])
> >
> > Bye
> > Gaetano
> >
> >> -----Original Message-----
> >> From: phpxmlrpc-bounces at lists.usefulinc.com
> >> [mailto:phpxmlrpc-bounces at lists.usefulinc.com]On Behalf Of
> >> Jeff Tupholme
> >> Sent: Monday, February 13, 2006 7:27 PM
> >> To: phpxmlrpc at lists.usefulinc.com
> >> Subject: Fwd: [phpxmlrpc] Multiple signatures
> >>
> >>
> >>
> >> I see now that such notices are a known issue when running 
> on PHP 5.
> >> However, it does suggest that multiple signature support is not
> >> perfect! I'll try again when PHPXMLRPC 2.0 is final.
> >>
> >> Thanks for your help.
> >>
> >>
> >> Jeff
> >>
> >>
> >> Begin forwarded message:
> >>
> >>> From: Jeff Tupholme <jeff-lists at makemyshow.com>
> >>> Date: 10 February 2006 11:39:19pm GMT
> >>> To: "<phpxmlrpc at lists.usefulinc.com>
> >> <phpxmlrpc at lists.usefulinc.com>"
> >>> <phpxmlrpc at lists.usefulinc.com>
> >>> Subject: Re: [phpxmlrpc] Multiple signatures
> >>>
> >>>
> >>> 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;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;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.
> 
> _______________________________________________
> phpxmlrpc mailing list
> phpxmlrpc at lists.usefulinc.com
> http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc
> 


More information about the phpxmlrpc mailing list