Calling the WordPress XMLRPC API from VB.net

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

Advertisements

0 thoughts on “Calling the WordPress XMLRPC API from VB.net

  1. I am having trouble getting an example of how to use xml-rpc.net, you are the best example of a client in vb.net I have seen. How did you parse the response? I have to call a method with one string parameter, which returns one integer struct and two string structs. Is there another method of writing the function and dealing with the result that you know?

    Like

  2. I am having trouble getting an example of how to use xml-rpc.net, you are the best example of a client in vb.net I have seen. How did you parse the response? I have to call a method with one string parameter, which returns one integer struct and two string structs. Is there another method of writing the function and dealing with the result that you know?

    Like

  3. Pingback: Scott Hanselman's Computer Zen - The Weekly Source Code 22 – C# and VB .NET Libraries to Digg, Flickr, Facebook, YouTube, Twitter, Live Services, Google and other Web 2.0 APIs

  4. Pingback: Scott Hanselman's Computer Zen - The Weekly Source Code 22 - C# and VB .NET Libraries to Digg, Flickr, Facebook, YouTube, Twitter, Live Services, Google and other Web 2.0 APIs

  5. Pingback: Blog Roundup for the 31st of July 2007 :: Christopher Ross

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s