Tuesday, July 31st, 2007
@tomic XML-RPC JavaScript Client
Jon Brisbin has created an XML-RPC JavaScript client called @tomic:
The @tomic XML-RPC client requires ExtJS 1.1, but has no other external requirements. It's designed to be easy-to-use, flexible, and robust enough for anything you might throw at it. Since this is an initial release, I'm putting it out as a beta (under the GPL).
-
-
Ext.onReady( function()
-
{
-
var xmlrpc = new Atomic.util.XMLRPC( {
-
url: "xmlrpc.php",
-
method: "blogger.getUsersBlogs"
-
} );
-
// Add parameters to the RPC call
-
xmlrpc.addParameter( "0123456789ABCDEF" );
-
xmlrpc.addParameter( "MyUsername" );
-
xmlrpc.addParameter( "mypassword" );
-
-
// Subscribe to events
-
xmlrpc.addListener( "success", function( xhr, xml ) {
-
// Handle the response from the XML-RPC service, which is in the 'xml' object
-
console.log( xml );
-
} );
-
xmlrpc.addListener( "fault", function( xhr, fault ) {
-
// Handle any faults issued by the XML-RPC server
-
Ext.MessageBox.alert( "XML-RPC fault #" + fault.code, fault.message );
-
} );
-
-
// make the call
-
xmlrpc.call( {
-
method: "blogger.getUsersBlogs",
-
params: [
-
"0123456789ABCDEF",
-
"MyUsername",
-
"mypassword"
-
]
-
} );
-
}
-












Requiring a 300k widget library just to detect onload and show an alert box? I like!
@Jordan: Ext is used non-trivially in the library itself. E.g.: DomQuery, Template, Observable, Ajax… To cut down the size the ~170 lines of code could probably be ported to JQuery/others with relative ease.
who-or-what@tomic?
From the author’s site:
JavaScript object you pass in, which should make the @tomic XML-RPC JavaScript client simple and flexible enough for any application you need to use it in (including Adobe AIR applications).
i.e. did you know how to make a reader for adobe air? Then don’t bag it (and if you do know how, then don’t hate, appreciate)
I don’t criticize anyone for using the (exclusively) GPL but I really think that a developer needs to be very careful using it due to it’s inability to be fully compatible with the commercial world.
Using the GPL, you immediately cut out a huge chunk of your potential user market.
What is happening here? 148 votes and a rating of 1.3? Looks like someone really doesn’t like the idea or the author.
I for my part like the idea of having a JavaScript client for XML-RPC services. Good job.
Jordan: Steve’s comment after yours is spot on. I use ExtJS at work as an integral part of our application. I’m also basing a lot of the @tomic framework on ExtJS. My assumption is that potential users of the framework will already be using ExtJS as a core requirement of their application.
Chad: I have no friggin’ clue what your comment means. Don’t drink and code, friend. Don’t drink and code.
Ian: I ruminated for quite a while on how to license this. Ext uses the LGPL and has a commercial option. The larger @tomic framework, though, will be the primary user of this XML-RPC client, so I wanted to use a license consistent with that code, which I feel the GPL is. If I need to reconsider, then I’d love to hear why.
Fabian: Thank you. :)
The example code in this article is not quite right. When the addParameter() method is called, you don’t need to pass more parameters in on the call() method. addParameter() is called for every parameter you give it in the call(), so all that is required in the example given is simply call().
Jon, Thanks for that last comment…the repetition in the example code made me think I was missing something. I also like the idea of a JS library for XML-RPC, but I’m not sure I can bear the 300k tax…but then again, I don’t know what ExtJS is. Back to google i go…