Some fun with Movable Type's XML-RPC features

| 0 Comments

Web services are all the rage today so I figured that I would try to figure some of that stuff out since they're very popular around here in Northern Virginia. So I got to playing around with some XML-RPC stuff today. I figured that since my blog software already exports some functions, that I would take advantage of that for testing some stuff out.

Note to other Movable Type users, your XML-RPC script, mt-xmlrpc.cgi, uses a different password than your account's password. It's automatically generated. To find it, and/or change it, go to the Authors page in the admin console, click on your username and scroll down to the bottom where it says something about a web services password.



import java.io.*;

import java.net.*;

import java.util.*;

import org.apache.xmlrpc.*;

import org.apache.xmlrpc.client.*;



public class MovableTypeTest

{

   public static void main(String[] args)

   {

      try

      {

         XmlRpcClient client = new XmlRpcClient();

         XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

         config.setServerURL(new URL("http://www.testing.com/mt/mt-xmlrpc.cgi"));

         client.setConfig(config);



         Vector parameters = new Vector();

         parameters.add("0123456789ABCDEF");

         parameters.add("USERNAME");

         parameters.add("PASSWORD");



         Object[] response = (Object[])client.execute("blogger.getUsersBlogs", parameters);

         System.out.println("Blogs:");

         for (Object o: response)

         {

            HashMap map = (HashMap)o;

            Iterator it = map.keySet().iterator();

            while (it.hasNext())

            {

               String key = (String)it.next();

               System.out.println("\t" + key + " = " + map.get(key));

            }

         }

      } catch (Exception ex) { ex.printStackTrace(); }

   }

}

Leave a comment

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Recent Entries

A window into the totalitarian mind of the left on freedom of religion
From Digg: Me: I'm not going to hold my breath waiting for the same liberal democrats who shriek about the…
Google's lossy compiler
Google's closure compiler service gets a little too frisky under ADVANCED_OPTIMIZATIONS. Original code: With advanced optimizations enabled, it was able…
The three purposes of the federal income tax law
Businesses will spend about 3.4 billion man-hours and individuals about 1.7 billion hours figuring out their taxes this year.…

Subscribe

Advertisements

OpenID accepted here Learn more about OpenID