Tuesday, July 31st, 2007

@tomic XML-RPC JavaScript Client

Category: JavaScript, Library

<>p>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).

javascript
< view plain text >
  1. Ext.onReady( function()
  2. {
  3.     var xmlrpc = new Atomic.util.XMLRPC( {
  4.         url: "xmlrpc.php",
  5.         method: "blogger.getUsersBlogs"
  6.     } );
  7.     // Add parameters to the RPC call
  8.     xmlrpc.addParameter( "0123456789ABCDEF" );
  9.     xmlrpc.addParameter( "MyUsername" );
  10.     xmlrpc.addParameter( "mypassword" );
  11.  
  12.     // Subscribe to events
  13.     xmlrpc.addListener( "success", function( xhr, xml ) {
  14.         // Handle the response from the XML-RPC service, which is in the 'xml' object
  15.         console.log( xml );
  16.     } );
  17.     xmlrpc.addListener( "fault", function( xhr, fault ) {
  18.         // Handle any faults issued by the XML-RPC server
  19.         Ext.MessageBox.alert( "XML-RPC fault #" + fault.code, fault.message );
  20.     } );
  21.  
  22.     // make the call
  23.     xmlrpc.call( {
  24.         method: "blogger.getUsersBlogs",
  25.         params: [
  26.              "0123456789ABCDEF",
  27.              "MyUsername",
  28.              "mypassword"
  29.         ]
  30.     } );
  31. }

Related Content:

Posted by Dion Almaer at 7:29 am
9 Comments

+----
1.6 rating from 178 votes

9 Comments »

Comments feed TrackBack URI

Requiring a 300k widget library just to detect onload and show an alert box? I like!

Comment by Jordan — July 31, 2007

@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.

Comment by Steve Clay — July 31, 2007

who-or-what@tomic?

Comment by Anonymous — July 31, 2007

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)

Comment by Chad Wagner — July 31, 2007

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.

Comment by Ian — July 31, 2007

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.

Comment by Fabian Jakobs — August 1, 2007

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. :)

Comment by Jon Brisbin — August 3, 2007

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().

Comment by Jon Brisbin — August 3, 2007

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…

Comment by Stephen — November 29, 2007

Leave a comment

You must be logged in to post a comment.