[development] module with XML RPC
Rob Thorne
rob at torenware.com
Fri Sep 1 09:05:31 UTC 2006
Another example module is the new Query Exporter module
(query_export.module) that's in contribute HEAD.
I expose views via XMLRPC server handlers. It's actually pretty easy to
do, since all you really need to do is register your handlers via
hook_xmlrpc. The structure you pass back in the hook is a bit arcane,
but if you read a few modules that use the hook, you'll figure it out.
I also implement a sort of "session" variable that lets the xmlrpc
client use drupal users for authentication. There may be a better way
to do this than what I did in query_export.module, but what I did works
pretty well for my particular application, and may work for you as well.
Cheers,
Rob
Rob Thorne
Torenware Networks
andrew morton wrote:
> On 8/31/06, Augustin (Beginner) <drupal.beginner at wechange.org> wrote:
>> How come the Drupal XML RPC API doesn't use any of the PHP XML RPC
>> functions
>> defined here: http://php.net/xmlrpc ?
>> Is this a completely different implementation?
>> Why?
>> Is there a historical/technical reason behind this?
>
> Well it's an extension and we can't depend on it being installed on
> most servers. That and the warning on the PHP site says it all: "This
> extension is EXPERIMENTAL. The behaviour of this extension --
> including the names of its functions and anything else documented
> about this extension -- may change without notice in a future release
> of PHP. Use this extension at your own risk."
>
>> How does a XML RPC "session" happen?
>
> As far as I know it's state-less, if you want sessions you'll need to
> write those.
>
>> I.e., if I have a drupal XML RPC client module, that needs to contact
>> a remote
>> XML RPC server, do I get a chance to send the call, get the reply and
>> process
>> that reply all within one page load, as if it were a SQL query?
>
> Yes, it's just a function call.
>
>> What modules exist that use XML RPC a lot, that I could study?
>>
>> How would a simple code snippet look like? (make a call to server,
>> get reply,
>> and have a if / else fork according to the reply we got - or display /
>> print_r() the content of the reply).
>
> I've done a bit with XML RPC in the station module. The archive and
> schedule sub-modules are desinged to run on different machines and
> grab program information remotely. The code is sort of scattered
> around but it's a working example.
>
> andrew
>
More information about the development
mailing list