function xmlrpc_example_xmlrpc in Examples for Developers 6
Same name and namespace in other branches
- 7 xmlrpc_example/xmlrpc_example.module \xmlrpc_example_xmlrpc()
Implements hook_xmlrpc().
Provides Drupal with an array to map XML-RPC callbacks to the functions implemented by this module.
See also
Related topics
File
- xmlrpc_example/
xmlrpc_example.module, line 131 - 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.
Code
function xmlrpc_example_xmlrpc() {
$methods[] = array(
'xmlrpc_example.add',
// Method name
'_xmlrpc_example_server_add',
// Callback to execute
array(
// Array of types for output/input parameteres
'int',
// the type of the return value
'int',
// the type of the first argument
'int',
),
t('Returns the sum of the two arguments.'),
);
// The subtract method is similiar to the addition
$methods[] = array(
'xmlrpc_example.subtract',
'_xmlrpc_example_server_subtract',
array(
'int',
'int',
'int',
),
t('Return difference of the two arguments.'),
);
return $methods;
}