[phpxmlrpc] variable number of parameters in client app

Matthias Korn korn at prometa.de
Wed Aug 8 09:21:32 BST 2007


Hi,

i have just a quick question on how to access a variable number of 
parameters in my php client app.
The current (w/o variable number of parameters) signature and parameter 
access looks like this:

//-------------------------
$getObjectById_sig = array( array( $xmlrpcStruct, $xmlrpcInt, 
$xmlrpcString ) );
$getObjectById_doc = 'Returns the Object for a given ObjectID and 
itemType.';
function getObjectById($m)
{
    global $xmlrpcerruser;
    $err = "";
    $n = php_xmlrpc_decode($m);
    $objectID     = $n[0];
    $objectType = $n[1];
    // ...
//-------------------------

But now the last param $xmlrpcString (later in $objectType) becomes an 
unknown number of params of the same type (string). The method call I 
get looks like this, where the last parameters is an unknown amount 
(here: three).

//-------------------------
<?xml version="1.0"?>
<methodCall>
  <methodName>getObjectById</methodName>
  <params>
    <param>
      <value>
        <i4>216205</i4>
      </value>
    </param>
    <param>
      <value>
        <string>ToDo_ToDo</string>
      </value>
    </param>
    <param>
      <value>
        <string>ToDo_Support</string>
      </value>
    </param>
    <param>
      <value>
        <string>ToDo_Contact</string>
      </value>
    </param>
  </params>
</methodCall>
//-------------------------

How do I have to modify signature and parameter access to achieve a 
variable number of parameters?

Thanks a lot,
Matthias Korn


More information about the phpxmlrpc mailing list