<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Alex James Brown &#187; xml rpc</title>
	<atom:link href="http://www.alexjamesbrown.com/tags/xml-rpc/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexjamesbrown.com</link>
	<description>My Words. By Me.</description>
	<lastBuildDate>Wed, 04 Jan 2012 01:02:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Specify XML-RPC Endpoints at Run Time With CookComputing XMLRPC.net</title>
		<link>http://www.alexjamesbrown.com/uncategorized/specify-xml-rpc-endpoints-at-run-time/</link>
		<comments>http://www.alexjamesbrown.com/uncategorized/specify-xml-rpc-endpoints-at-run-time/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 14:39:26 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[JoeBlogs]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xml rpc]]></category>

		<guid isPermaLink="false">http://www.alexjamesbrown.com/?p=265</guid>
		<description><![CDATA[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 ...]]></description>
			<content:encoded><![CDATA[<p>A common question when using <a href="http://www.xml-rpc.net/" target="_blank">Cook Computing XML RPC.net</a> 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 <a href="http://www.alexjamesbrown.com/geek/c-wordpress-wrapper/" target="_blank">develop a wrapper</a>.</p>
<p>To enable me to create <a href="http://joeblogs.codeplex.com/" target="_blank">JoeBlogs</a>, I made use of the IXmlRpcProxy Proxy classes…</p>
<p>I created my interface, implementing IXmlRpcProxy:</p>
<p>We define the method as an XML RPC method using XmlRpcMethod.<br />
The name of the method is also specified.<br />
In this case, we are using getPost from the <a href="http://www.xmlrpc.com/metaWeblogApi" target="_blank">metaWeblog XML RPC API</a> – WordPress supports this, as well as the <a href="http://www.blogger.com/developers/api/">Blogger API</a> and the <a href="http://www.sixapart.com/developers/xmlrpc/movable_type_api/">Movable Type API</a>.<br />
They also have their own (which is an extension to the Moveable Type API) &#8211; <a title="http://codex.wordpress.org/XML-RPC_wp" href="http://codex.wordpress.org/XML-RPC_wp"></p>
<p>http://codex.wordpress.org/XML-RPC_wp</a></p>
<p>Anyway…..</p>
<p>As per the metaWeblog.getPost specification, we need to pass in the postid, username, and password. So we create our interface as follows:</p>
<pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">	public interface IMyProxy: IXmlRpcProxy
	{
		[XmlRpcMethod("metaWeblog.getPost")]
		Post GetPost(string postid, string username, string password);
  	}</pre>
<p>As we can see, this returns a “Post”</p>
<p>This is a struct, that basically defines the structure of the response.</p>
<pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">	[XmlRpcMissingMapping(MappingAction.Ignore)]
	public struct Post
	{
		public DateTime dateCreated;
		public string description;
		public string title;
		public string postid;
		public string[] categories;

		public override string ToString()
		{
			return this.description;
		}
	}</pre>
<p>To use this,  you need to create an instance of the proxy object.</p>
<p>XML RPC.net provides a method called XmlRpcProxyGen to do this for us.</p>
<p>We then set the Url, which is declared as part of IXmlRpcProxy (remember IMyProxy implemented this interface…)</p>
<p>Since our proxy declared the method GetPost, we can now use this, pass in the required post id, username and password.</p>
<pre class="brush: csharp; auto-links: true; collapse: false; first-line: 1; gutter: true; html-script: false; light: false; ruler: false; smart-tabs: true; tab-size: 4; toolbar: true;">    public void myTest()
    {
      string postId = "1234";
      string username = "myUsername";
      string password = "password";

      var proxy = (IMyProxy)XmlRpcProxyGen.Create(typeof(IMyProxy));
      proxy.Url = "www.alexjamesbrown.com";

      var post = proxy.GetPost(postId, username, password);
    }</pre>
<p>And there we have it.</p>
<p>Of course this is a very bare bones example.</p>
<p><a href="http://joeblogs.codeplex.com/" target="_blank">JoeBlogs</a> contains much more separation of these concerns.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexjamesbrown.com/uncategorized/specify-xml-rpc-endpoints-at-run-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>C# WordPress Wrapper</title>
		<link>http://www.alexjamesbrown.com/uncategorized/c-wordpress-wrapper/</link>
		<comments>http://www.alexjamesbrown.com/uncategorized/c-wordpress-wrapper/#comments</comments>
		<pubDate>Thu, 21 May 2009 23:14:53 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[JoeBlogs]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[xml rpc]]></category>

		<guid isPermaLink="false">http://www.alexjamesbrown.com/geek/c-wordpress-wrapper/</guid>
		<description><![CDATA[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 ...]]></description>
			<content:encoded><![CDATA[<p>Ok, I’ve barely finished this as a stable release, but I thought I’d post this up any way….</p>
<p>A little open source project I’m working on – <a href="http://joeblogs.codeplex.com/" target="_blank">Joe Blogs</a>.</p>
<p>In a nutshell, it allows easy communication to your WordPress (or other blog) via an xml-rpc interface.</p>
<p>Big thanks to the work by Charles Cook at <a title="http://www.xml-rpc.net/" href="http://www.xml-rpc.net/">http://www.xml-rpc.net/</a></p>
<p><a href="http://joeblogs.codeplex.com/" target="_blank">Joe Blogs</a> is currently hosted on CodePlex &#8211; <a title="http://joeblogs.codeplex.com/" href="http://joeblogs.codeplex.com/">http://joeblogs.codeplex.com/</a></p>
<p>I’ll be posting more info, tutorials, documentation etc… in the coming days and weeks.</p>
<p><strong>Update</strong></p>
<p>See here for usage instructions:<br />
<a href="http://www.alexjamesbrown.com/geek/using-joeblogs/" target="_blank">http://www.alexjamesbrown.com/geek/using-joeblogs/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexjamesbrown.com/uncategorized/c-wordpress-wrapper/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

