Search This Blog

07 October 2007

Update on XML_RPC

Wow, it actually worked with only minor changes to the code. Check this out:

mysql> create function xml_get_state(id int) returns text
-> no sql language xmlrpc external name
-> 'xmlrpc://betty.userland.com/RPC2;examples.getStateName';
Query OK, 0 rows affected (0.00 sec)

mysql> select xml_get_state(40);
+-------------------+
| xml_get_state(40) |
+-------------------+
| South Carolina |
+-------------------+
1 row in set (0.42 sec)

Now I just need to check that it works for more complex resultsets... Trawl the web for open-access trivial XML-RPC services or build a test XML-RPC server?

A few fun ideas... XML-RPC as a Stored Procedure.

Wouldn't it be fun to be able to embed web-service routines into MySQL as if they are stored procedures?
CREATE FUNCTION xml_current_time() RETURNS DATETIME NO SQL
LANGUAGE XMLRPC
EXTERNAL NAME "xmlrpc://time.userland.com/RPC2;currentTime.getCurrentTime";

Perhaps not a completely useful example... but an interesting goal to achieve. I have written up some code and pushed it to the experimental repository. I haven't tested it yet but I may do later today if I don't get too preoccupied catching up watching NBC's "Heroes". Snapshots created automagically at midnight, Pacific time.