« On SSL Warnings and Text Link Ads | Main | Tomcat 6.0.20 Released »


Groovy XMLRPC: Tying the Blog Pinger Scripts Together

With a little free time today while waiting for my change window to start, I've taken the four groovy xmlrpc-based scripts from this article and from this one and consolidated them into one. The format of these RPC interfaces to a blog directory's ping API are surprisingly similar, which makes me assume that some dude wrote one that everyone copies. All of these services look for a blog title, followed by the URL of your blog. Some of them also utilize an "Extended" ping service for including your site's feed URL. Essentially though, these are a bunch of HTTP POSTs—just look at a wireshark trace.

My next step is to see if I can consolidate these further and make them worthy of the respect and admiration of a mainstream groovy developer. Here's the current iteration of this script.

#!/usr/bin/env groovy
/* Written by Chris M. 
# The first version of this script tied the 6 XML-RPC-based 
# Blog Ping scripts together into one somewhat fancier script. 
# Not very elegant but less scripts to run. The second version
# coverts some of the variables into hashes or arrays
# import the XML-RPC service */
import groovy.net.xmlrpc.*

// Define the Ping URL "endpoints"
def technoratiURL = "http://rpc.technorati.com/rpc/ping"
def icerocketURL = "http://rpc.icerocket.com:10080/"
def blogsURL = "http://ping.blo.gs/"
def weblogsURL = "http://rpc.weblogs.com/RPC2"
def bloglinesURL = "http://www.bloglines.com/ping"
def blogcatalogURL = "http://rpc.blogcatalog.com/"

def urls = [
assert urls.size() == 6
assert urls['Blo.gs'] == 'http://ping.blo.gs/'

// You'll want to make this next section your own
def myblogTitle = "blogging techstacks"
def myblogURL = "http://blog.techstacks.com/"
def myfeedURL = "http://feeds2.feedburner.com/BloggingTechstacks"

// Here is the section responsible for iterating through each ping
// url.

def technoServer = new XMLRPCServerProxy(technoratiURL)
def icerocketServer = new XMLRPCServerProxy(icerocketURL)
def blogsServer = new XMLRPCServerProxy(blogsURL)
def weblogsServer = new XMLRPCServerProxy(weblogsURL)
def bloglinesServer = new XMLRPCServerProxy(bloglinesURL)
def blogcatalogServer = new XMLRPCServerProxy(blogcatalogURL)

def technoResult = technoServer.weblogUpdates.ping(myblogTitle, myblogURL)
def icerocketResult = icerocketServer.ping(myblogTitle, myblogURL)
def blogsResult = blogsServer.weblogUpdates.extendedPing(myblogTitle, myblogURL, myfeedURL)
def weblogsResult = weblogsServer.weblogUpdates.extendedPing(myblogTitle, myblogURL, myfeedURL)
def bloglinesResult = bloglinesServer.weblogUpdates.extendedPing(myblogTitle, myblogURL, myfeedURL)
def blogcatalogResult = blogcatalogServer.weblogUpdates.ping(myblogTitle, myblogURL)

// Here is the section responsible for displaying output
// Technorati's been unavailable a lot lately due to a colo move.

if (technoResult != null)
 println "Thanks for the ping from Technorati"

if (icerocketResult != null)
 println "Thanks for the ping from IceRocket!!"

if (blogsResult != null)
 println "Thanks for the ping from Blo.gs"

if (weblogsResult != null)
 println "Thanks for the ping from Weblogs.com"

if (bloglinesResult != null)
 println "Thanks for the ping from Bloglines"

if (blogcatalogResult != null)
 println "Thanks for the ping from BlogCatalog"


TrackBack URL for this entry:

Listed below are links to weblogs that reference Groovy XMLRPC: Tying the Blog Pinger Scripts Together: