xmlrpc_server.module in Services 6
@author Services Dev Team
Enable XML-RPC for services module.
File
servers/xmlrpc_server/xmlrpc_server.moduleView source
<?php
/**
* @author Services Dev Team
* @file
* Enable XML-RPC for services module.
*/
/**
* Implementation of hook_server_info().
*/
function xmlrpc_server_server_info() {
return array(
'#name' => 'XMLRPC',
'#path' => 'xmlrpc',
);
}
function xmlrpc_server_server() {
require_once './includes/xmlrpc.inc';
require_once './includes/xmlrpcs.inc';
return xmlrpc_server(xmlrpc_server_xmlrpc());
}
function xmlrpc_server_xmlrpc() {
$callbacks = array();
foreach (services_get_all() as $method) {
$args = array();
foreach ($method['#args'] as $arg) {
if (!is_array($arg)) {
$args[] = $arg;
}
else {
$args[] = $arg['#type'];
}
}
$callbacks[] = array(
$method['#method'],
'xmlrpc_server_call_wrapper',
array_merge(array(
$method['#return'],
), $args),
$method['#help'],
);
}
return $callbacks;
}
function xmlrpc_server_call_wrapper() {
$xmlrpc_server = xmlrpc_server_get();
$method_name = $xmlrpc_server->message->methodname;
$args = func_get_args();
return services_method_call($method_name, $args);
}
function xmlrpc_server_server_error($message) {
static $xmlrpcusererr;
if (!is_array($message)) {
$message = array(
$message,
);
}
$message = implode(' ', $message);
return xmlrpc_error($xmlrpcusererr + 1, strip_tags($message));
}
Functions
Name | Description |
---|---|
xmlrpc_server_call_wrapper | |
xmlrpc_server_server | |
xmlrpc_server_server_error | |
xmlrpc_server_server_info | Implementation of hook_server_info(). |
xmlrpc_server_xmlrpc |