[phpxmlrpc] Converting xmlrpcval object array to PHP object array abstractly or dynamically?

David Luu mangaroo at gmail.com
Sun Jun 16 16:16:16 EDT 2013


Hello,

Don't know if anyone has asked this before, since the mailing list archive
spans a long time, it's just easier for me to re-ask if asked before.

I'm working on a XML-RPC service that reflects any given PHP class. One
XML-RPC method takes any number of arguments from the XML-RPC request/call.

In the XML-RPC method, I then store all the arguments into a PHP array of
xmlrpcvals, via iterating over xmlrpcmsg->getParam(n) for the total # of
params based on getNumParams().

I would then like to dynamically/abstractly handle converting each element
of that xmlrpcval array into its PHP object equivalent, where the element
may be a scalar, array, or struct (generally scalar or array). And that
array may contain yet more scalars, arrays, or structs (though for simple
case most likely scalars).

How might I recursively and/or iteratively parse the xmlrpcval array into
it's PHP equivalent in a way that handles all cases? Since we don't know
until runtime (i.e. when XML-RPC call is made) what the exact arguments are
(type and number of them).

Has anyone done something similar before? I've done similar for other
language platforms but those libraries did more implicit conversion
handling for me, so I didn't have to go into this level of detail as with
this PHP library.

I'm planning to try to work something out when I have time, and in the
meantime, handle the simple case for now where the array will always be of
scalars (not array within array), and ignore structs. And wanted to see
what feedback/tips I can get from the community, hence this email.

Regards,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.usefulinc.com/pipermail/phpxmlrpc/attachments/20130616/fef9eaa3/attachment.html>


More information about the phpxmlrpc mailing list