-
Notifications
You must be signed in to change notification settings - Fork 12
XML RPC Overview
XML-RPC is described in the official XML-RPC specification. The most important points for IXR users are covered here.
XML-RPC requests consist of a methodName and zero or more paramaters. The methodName specifies the method that should be executed by the server, and is usually (but not necessarily) of the form qualifier.methodname. Any number of paramaters can be provided but each paramater must be of the following types: int, float, boolean, string, dateTime or base64-encoded data. In addition to those types, paramaters may also consist of arrays or structs. An array is a linear collection of other data types (potentially including other arrays and structs) while a struct is an indexed array, again with the ability to contain nested compound types.
This simple selection of types combined with two flexible compound data structures makes XML-RPC a powerful way of transferring data.
In IXR, an XML-RPC procedure call looks like this:
$client->query('method.name', $paramater1, $parameter2, ...);
The paramaters can be normal PHP variables, PHP arrays, PHP indexed arrays or even PHP objects (which will be converted in to structs by the library).
An XML-RPC procedure returns a single value. However, as this value can be any of the types described above (including arrays and structs) it is possible to return an unlimited amount of structured data from each procedure call. IXR maps XML-RPC requests straight to PHP functions or class methods and handles the type conversion automatically - all you have to do is write a function that returns a value (or array or indexed array) and IXR will handle the rest.
In XML-RPC, errors are represented by a numeric error code and a descriptive error message string. IXR represents these errors as IXR_Error objects. The library will automatically generate these whenever something goes wrong, and will make the error objects available for processing by your own error handling code.