PEAR XML_RPC Part 2

  • Posted by Mike Naberezny in PHP

    Regarding my earlier woes about XML-RPC functions in the global scope, upgrading to the latest stable version of XML_RPC has mostly alleviated the problem. This complaint was addressed in Bug 3363 and fixed in version 1.2.0RC7. Since this fix, the dispatch map can now utilize class functions, albeit only statically. In the dispmap, the functions may be declared one of two ways:

    'function' => 'myClass::rpcFunction'

    or

    'function' => array('myClass', 'rpcFunction')

    Allowing class functions to be mapped is a great improvement. I am now using a class for my XML-RPC API, with a class method to return the dispmap to be passed into XML_RPC_Server.

    The ability for XML_RPC_Server to call class functions has an additional benefit for PHP5 users, at least until something like XML_RPC2 becomes stable. In PHP5, the function get_class_methods() is now case sensitive, so introspection may be used to build the function declarations in the dispmap. However, this will still not be enough to generate the method signature or docstring. PHP5′s Reflection API can accomplish this, and it can even be used to get the docstring.

1 comment

  • comment by Robert Gravina 1 Dec 05

    This is great news! I was using the Incutio library http://scripts.incutio.com/xmlrpc/ however since I’ve started using PHP5, this no longer seems to work correctiy – not suprising since the last update was somtime in 2003. There is a new beta in the works http://www.phppatterns.com/docs/develop/xmlrpc_progress however I how trouble getting this one going. The archtecture, and the way it is used, looks like great OO however. I wish PEAR would adopt something similar to the way this new IXR beta works!

    I’m not quite sure if the IXR project is still going anywhere, so I’d prefer to stick with PEAR.

    Still though, with PHP5′s new object model, I’m surprised there isn’t yet a good OO xml-rpc implementation that makes use of the reflection API.

    If I didn’t have a ton of code that’s already been written, I would gladly move over to Python, Ruby et al.

Post a comment


Thanks for commenting. Please remember to be nice to others and keep your comment relevant to the discussion. I reserve the right to remove comments that don't meet these simple guidelines.