Thursday, May 24, 2007

How to notify about blog updates with XML-RPC

Javablogs supports notification of blog updates with a remote API, which enables new blog post to appear on Javablogs immediately (javablogs API). I use blogger and as far as I can tell it doesn't support pinging So i set out to write my own XML-RPC client to make my posts appear quickly (Yes I'm the impatient type).

Did a search for XML-RPC clients on the web and I found this open source Java library from Redstone. Downloaded the jar file and followed the instructions on Redstone page and the page describing the Weblogs API. I have to say when I started on this I didn't think it would be this easy but after about 10 minutes I had it working :).

Just add the following lines inside a main method and execute:

String weblogName = "Living Tao";
String weblogUrl = "";

//create a client pointing to the rpc service on javablogs
XmlRpcClient client = new XmlRpcClient("", true);

//invoke the method to queue the blog for an update
Object token = client.invoke("", new Object[] { weblogName, weblogUrl} );

The code will out put the following result on successful execution:

{flError=0, message=Success. 1 blogs have been queued for update}

Don' forget to click the +1 button below if this post was helpful.


Krishna said...

Thanks for sharing the info. It is very much useful:
Java Articles

Jagna Co Kalani said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.