Proposal for "XML_RPC2 (reproposal)"

» Metadata » Status
» Description

This is a reproposal of XML_RPC2. As I've mentioned to the list before, I'm glad to announce Greg and I have come to terms with a consensual design for XML_RPC2.

Against the original proposal, this version of XML_RPC2 exhibits the following differences:

  • The xmlrpc extension backend is implemented
  • The XML_RPC2_Value class subtree was moved to XML_RPC2_Backend_Php
  • XML_RPC2_Value now houses a factory interface for explicitely encoding XML-RPC types.

It is also important to clear two important points raised in the previous discussion:

  • XML_RPC2 development was approved by Stig Bakken (XML_RPC lead), last October. Although a proposal/voting cycle was not strictly required, this package is important enough to merit external attention during a major upgrade.
  • XML_RPC2 unit tests include testing against a python server to guarantee cross-language compatibility.

Now, for the 'old' proposal:

XML_RPC2 is a PEAR implementation of the XML-RPC protocol. This is a rewrite, targeting PHP version 5. The original code was posted by Greg Beaver to the list a couple months ago.

Relative to the previous version, XML_RPC2 takes advantage of the following PHP5 features:

  • SimpleXML
  • __call catchall for automatic proxy creation
  • xmlrpc extension (optionally and detected at runtime)
  • Reflection API

The end result is a simpler usage of XML-RPC in PHP. Remote servers are exposed as proxy classes created at runtime:

$xmlrpc = new XML_RPC2_Client('');
$ret = $xmlrpc->test('PEAR_Server');

Servers are created by exposing a class containing the exported methods:

class Example 
    /** Answer with pong i
     * @return string
    public ping()
        return 'pong';
(XML_RPC2_Server::create(new Example())->handleCall();

Method introspection is done with a combination of the Reflection API and parsing of Docblocks of the exported methods.

» Dependencies » Links
  • curl extension
  • xmlrpc extension (optional)
» Timeline » Changelog
  • First Draft: 2005-06-13
  • Proposal: 2005-06-13
  • Call for Votes: 2005-06-26