rPath Appliance Platform Agent:XML-RPC in Plugin Development
From rPath Wiki
rPath Appliance Platform Agent allows plugins to be exposed for XML-RPC clients. The rAPA XML-RPC page describes how rAPA's code exposes functions and how XML-RPC clients can call those functions. Use the information on this page to ensure XML-RPC clients can call the functions in your custom rAPA plugins.
The image shown here shows a "facade" layer between an XML-RPC client and the code in the web component of the rAPA plugin. The XML-RPC client calls the facade which in turn calls the functions in the web component. If a plugin provides a custom facade class, rAPA will use that class; otherwise it will use rAPA's default facade superclass. All XML-RPC calls must go through the facade while calls from the browser interface can bypass the facade and directly use the web component. The facade uses /xmplrc in the URL, such as in: https://admin:password@localhost:8003/xmlrpc/myplugin/MyPlugin/
To make functions in a custom plugin available for XML-RPC clients, decorate them with @raa.web.expose with allow_xmlrpc=True as described in the Plugin Decorators page for rAPA plugin development.
To customize the facade, create an rpc directory to parallel with your web and srv directories in your plugin code. Create the facade class in a file in this directory.
The following is the contents of rpc/examplePlugin.py used to create a sample custom facade:
import raa.web
from raa.modules import raarpcplugin
class examplePlugin(raarpcplugin.rAARpcPlugin):
@raa.web.expose(allow_xmlrpc=True)
def atest4(self, a):
return dict(proxied=a)
To call the web class from a function in the facade class, use code similar to that in the default class; view the default rAARpcPlugin class source code (clicking the linked "..." to expand that section on the page).
When a custom plugin is ready to test by XML-RPC, reference rAPA XML-RPC on how to make calls from an XML-RPC client.

