Home « Server software «
Documentation: services/xml_rpc.php
services/xml_rpc.php - XML-RPC server broker
This script dispatch received XML-RPC requests to the adequate module.What does this script?
When this script is invoked remotely as a web service, it processes the incoming call through following steps:- decode received parameters according to the XML-RPC specification
- load the script that has been hooked to the method called and capture results
- encode these results and transmit them back to the caller
The encoding and decoding opperations are delegated to some instance of a xml_rpc_codec object, as implemented in services/xml_rpc_codec.php.
How to implement a new XML-RPC back-end service?
Any PHP function may be used to implement a web service, through some hook definition. Example:// server hook to some web service
global $hooks;
$hooks[] = array(
'id' => 'search',
'type' => 'serve',
'script' => 'services/search_service.php',
'function' => 'Search::serve',
'label_en' => 'Remote search',
'label_fr' => 'Recherche distante',
'description_en' => 'Example of remote search configuration.',
'description_fr' => 'Exemple de configuration pour recherche distante.',
'source' => 'http://www.yetanothercommunitysystem.com/'
);
The hook is automatically converted by control/scan.php into a call to the target service function. For example, the previous declaration appears into
shared/hooks.include.php
as:
function serve_scripts($id, $parameters) {
global $local, $context;
switch($id) {
case 'search':
include_once $context['path_to_root'].'services/search_service.php';
$result = array_merge($result, Search::serve($parameters));
break;
}
return $result;
}
This script is a reference file of this system.
Voir aussi:
Licence: GNU Lesser General Public License
Auteurs:
- Bernard Paques bernard.paques@bigfoot.com