Discussion:
[phpxmlrpc] passing null to a method
Christian
2010-03-30 00:34:20 UTC
Permalink
I've created a signature that looks like this:

signature' => array(array($xmlrpcArray, $xmlrpcInt, $xmlrpcInt,
$xmlrpcString, $xmlrpcInt, $xmlrpcInt))),

and set $GLOBALS['xmlrpc_null_extension']=true to enable null-value
parameters.

I would like to fill only some of the parameteres. So I try to pass null
values to the method. But xml-rpc says that null can't be passed to a no-nil
parameter? What's the use for null parameteres then?

It seems that I need to make an empty signature to be able to pass variable
number of parameteres? But I would prefer a signature that validates the
input.

So in short: Is it really not legal to pass nil values to a non-nil
signature parameter?

Thanks in advance.
Barsum


*My request:
*
<xml>
<methodCall>
<methodName>gymlog.getExercises</methodName>
<params>
<param>
<value>
<int>62</int>
</value>
</param>
<param>
<value>
<int>2</int>
</value>
</param>
*<param>
<value>
<nil />
</value>
</param>
*<param>
<value>
<int>0</int>
</value>
</param>
<param>
<value>
<int>10</int>
</value>
</param>
</params>
</methodCall>
</xml>

*The response:
*
<?xml version="1.0"?>
<methodResponse>
<fault>
<value>
<struct><member><name>faultCode</name>
<value><int>15</int></value>
</member>
<member>
<name>faultString</name>
<value><string>Invalid request payload found not-xmlrpc xml element
NIL</string></value>
</member>
</struct>
</value>
</fault>
</methodResponse>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20100330/0491c5e5/attachment.htm
Loading...