array and
struct data types encapsulate multiple values, each of which can be of any
data type.
If you are wondering exactly why we care about the different data types in
XML-RPC, it is because we need them in order to create a signature for the different
XML-RPC calls. A signature defines the data that is outputted and inputted by a
web service call.
We will start by creating a plugin called 'foobar' that will perform some basic
mathematical functions. The first thing we need to do is create a handler for the
onGetWebServices event:
$mainframe->registerEvent('onGetWebServices', 'plgXMLRPCFoobar');
/**
* Gets the available XML-RPC functions
*
* @return array Definition of the available XML-RPC functions
*/
function plgXMLRPCFoobar()
{
// get the XMl-RPC types
global $xmlrpcI4, $xmlrpcInt, $xmlrpcBoolean, $xmlrpcDouble,
Chapter 10
[ 303 ]
$xmlrpcString, $xmlrpcDateTime, $xmlrpcBase64,
$xmlrpcArray, $xmlrpcStruct, $xmlrpcValue;
// return the definitions
return array
(
// addition service
'foobar.
Pages:
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417