xml rpc

Blog posts tagged 'xml rpc'

Specify XML-RPC Endpoints at Run Time With CookComputing XMLRPC.net

Jul 6 09

A common question when using Cook Computing XML RPC.net to talk to blogs etc… is how to specify a blog / endpoint at runtime? Most of the examples seem to specify the details in an attribute… not much use if you’re trying to develop a wrapper.

To enable me to create JoeBlogs, I made use of the IXmlRpcProxy Proxy classes…

I created my interface, implementing IXmlRpcProxy:

We define the method as an XML RPC method using XmlRpcMethod.
The name of the method is also specified.
In this case, we are using getPost from the metaWeblog XML RPC API – WordPress supports this, as well as the Blogger API and the Movable Type API.
They also have their own (which is an extension to the Moveable Type API) –
http://codex.wordpress.org/XML-RPC_wp

Anyway…..

As per the metaWeblog.getPost specification, we need to pass in the postid, username, and password. So we create our interface as follows:

As we can see, this returns a “Post”

This is a struct, that basically defines the structure of the response.

To use this,  you need to create an instance of the proxy object.

XML RPC.net provides a method called XmlRpcProxyGen to do this for us.

We then set the Url, which is declared as part of IXmlRpcProxy (remember IMyProxy implemented this interface…)

Since our proxy declared the method GetPost, we can now use this, pass in the required post id, username and password.

And there we have it.

Of course this is a very bare bones example.

JoeBlogs contains much more separation of these concerns.

C# WordPress Wrapper

May 22 09

Ok, I’ve barely finished this as a stable release, but I thought I’d post this up any way….

A little open source project I’m working on – Joe Blogs.

In a nutshell, it allows easy communication to your WordPress (or other blog) via an xml-rpc interface.

Big thanks to the work by Charles Cook at http://www.xml-rpc.net/

Joe Blogs is currently hosted on CodePlex – http://joeblogs.codeplex.com/

I’ll be posting more info, tutorials, documentation etc… in the coming days and weeks.

Update

See here for usage instructions:
http://www.alexjamesbrown.com/geek/using-joeblogs/