Converting xmlrpcval object array to PHP object array abstractly or dynamically?
David Luu <[email protected]> Sun, 16 Jun 2013 13:16:16 -0700
| Newsgroups | gmane.comp.php.xml-rpc |
|---|---|
| Message-ID | <CA+V6+ZChYe41AQ8pwNetKVjV7JmYX6LiN-r+NLLtJHMH+5ZEug@mail.gmail.com> |
--===============7290321663495970325== Content-Type: multipart/alternative; boundary=047d7b2e4b5e02999f04df4b2749 --047d7b2e4b5e02999f04df4b2749 Content-Type: text/plain; charset=ISO-8859-1 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 --047d7b2e4b5e02999f04df4b2749 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Hello,<br></div><div><br></div><div>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.</div><div><br> </div><div>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 r= equest/call.</div><div><br></div><div>In the XML-RPC method, I then store a= ll the arguments into a PHP array of xmlrpcvals, via iterating over xmlrpcm= sg->getParam(n) for the total # of params based on getNumParams().</div> <div><br></div><div>I would then like to dynamically/abstractly handle conv= erting each element of that xmlrpcval array into its PHP object equivalent,= where the element may be a scalar, array, or struct (generally scalar or a= rray). And that array may contain yet more scalars, arrays, or structs (tho= ugh for simple case most likely scalars).</div> <div><br></div><div>How might I recursively and/or iteratively parse the xm= lrpcval 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) wha= t the exact arguments are (type and number of them).</div> <div><br></div><div>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.</div> <div><br></div><div>I'm planning to try to work something out when I ha= ve time, and in the meantime, handle the simple case for now where the arra= y will always be of scalars (not array within array), and ignore structs. A= nd wanted to see what feedback/tips I can get from the community, hence thi= s email.</div> <div><br></div><div>Regards,</div><div>David</div></div> --047d7b2e4b5e02999f04df4b2749-- --===============7290321663495970325== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ phpxmlrpc mailing list [email protected] http://lists.usefulinc.com/cgi-bin/mailman/listinfo/phpxmlrpc --===============7290321663495970325==--