Example: XML-RPC

XML-RPC client/server. (drupal 6)

This is an example of how to implement an XML-RPC server by registering callbacks to specific methods and how to make xmlrpc calls using the builtin xmlrpc() factory provided by Drupal.

For experimentation you may be interested in the XMLRPC Tester module.

Note that the Services module is probably the more common way to do XMLRPC at this time.

See also

hook_xmlrpc()

xmlrpc()

xmlrpc_errno()

xmlrpc_error_msg()

Functions & methods

NameDescription
xmlrpc_example_client_add_submitSubmit: query the xmlrpc endpoint for the method xmlrpc_example.add and report the result.
xmlrpc_example_client_formPresent a form that makes use of xmlrpc services to add or subtract.
xmlrpc_example_client_subtract_submitSubmit for subtraction: Call the xmlrpc method and report the result.
xmlrpc_example_menuImplementation of hook_menu(). Register all the demonstration forms.
xmlrpc_example_server_formPresent a form to configure the xmlrpc service options. In this case the max and min values for any of the operations (add or subtraction).
xmlrpc_example_xmlrpcImplements hook_xmlrpc().
_xmlrpc_example_server_addSum the two arguments.
_xmlrpc_example_server_subtractReturn the difference of the two arguments.

examples/xmlrpc_example/xmlrpc_example.module, line 21