As an example, I will call the getCategories API method.

Add a reference to the XML-RPC.net library.

Create a struct for the return result

Public Structure category
    Public categoryId As Object
    Public parentId As Object
    Public description As Object
    Public categoryName As Object
    Public htmlUrl As Object
    Public rssUrl As Object
End Structure

Create the interface for the API

<XmlRpcUrl("http://myblog.blogstogo.com/xmlrpc.php")> _
Public Interface IWP
    Inherits IXmlRpcProxy

    <XmlRpcMethod("wp.getCategories")> _
     Function getCategories(ByVal args() As String) As category()
End Interface

Call the API

Dim proxy As IWP = XmlRpcProxyGen.Create(Of IWP)()
Dim args() As String = {"http://myblog.blogstogo.com", _
                          "username", "password"}
Dim categories() As category
categories = proxy.getCategories(args)

That’s it… Pretty straight forward.

kick it on DotNetKicks.com

This entry was posted on Tuesday, July 31st, 2007 at 12:27 am and is filed under Blogging, Programming. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.