<?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>udayv . soundc &#187; Silverlight</title>
	<atom:link href="http://www.soundc.de/blog/category/programming/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.soundc.de/blog</link>
	<description>Electronic Music, Programming</description>
	<lastBuildDate>Tue, 04 May 2010 14:36:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XML-RPC for Silverlight updates</title>
		<link>http://www.soundc.de/blog/2009/03/01/xml-rpc-for-silverlight-updates/</link>
		<comments>http://www.soundc.de/blog/2009/03/01/xml-rpc-for-silverlight-updates/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 04:51:49 +0000</pubDate>
		<dc:creator>verma</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://www.soundc.de/blog/?p=162</guid>
		<description><![CDATA[I just finished uploading the source for the XmlRpc library for Silverlight.  You can access it at the google code page for xml-rpc for silverlight.  Its work in progress but I believe the library will mature with time. 
I have included some documentation on the Usage wiki page.
/
]]></description>
			<content:encoded><![CDATA[<p>I just finished uploading the source for the XmlRpc library for Silverlight.  You can access it at the google code page for <a href="http://code.google.com/p/xmlrpc-silverlight/">xml-rpc for silverlight</a>.  Its work in progress but I believe the library will mature with time. </p>
<p>I have included some documentation on the Usage wiki page.</p>
<p>/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundc.de/blog/2009/03/01/xml-rpc-for-silverlight-updates/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>XML-RPC for Silverlight</title>
		<link>http://www.soundc.de/blog/2009/01/28/xml-rpc-for-silverlight/</link>
		<comments>http://www.soundc.de/blog/2009/01/28/xml-rpc-for-silverlight/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 22:39:24 +0000</pubDate>
		<dc:creator>verma</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.soundc.de/blog/?p=151</guid>
		<description><![CDATA[I have been looking for a nice implementation of XML-RPC for silverlight for a while now.  There are a few good resources out there such as XML-RPC.NET, but they don&#8217;t really work on Silverlight.  
Silverlight is different, that it only has asynchronous network calls and you can&#8217;t really imitate sync calls, which makes [...]]]></description>
			<content:encoded><![CDATA[<p>I have been looking for a nice implementation of XML-RPC for silverlight for a while now.  There are a few good resources out there such as <a href="http://www.xml-rpc.net/">XML-RPC.NET</a>, but they don&#8217;t really work on Silverlight.  </p>
<p>Silverlight is different, that it only has asynchronous network calls and you can&#8217;t really imitate sync calls, which makes the use of a RPC a little weird.</p>
<p>I have written a small XML-RPC library for Silverlight.  Actually its just a single C# file which users can just drag and drop into their projects.  The library is still under development, presently I am hacking together a parser, making sure it works with the most common scenarios.</p>
<p>Here is what the usage of this library looks like.  You instantiate a service class, and then instantiate query requests as shown below:</p>
<pre class="brush: csharp;">
XmlRpcService service
            = new XmlRpcService (&quot;http://betty.userland.com/RPC2&quot;);
XmlRpcRequest req
            = new XmlRpcRequest (service, &quot;examples.getStateName&quot;,
                     new object [] { 10 });
req.XmlRpcCallCompleteHandler
            += new XmlRpcCallComplete (req_XmlRpcCallCompleteHandler);

req.Execute (null);
</pre>
<p>Once your call completes or some error occurs, your event handler is invoked (Here I am just assuming that the call succeeded):</p>
<pre class="brush: csharp;">
void req_XmlRpcCallCompleteHandler (XmlRpcResponse response, object userState) {
    string result = (string)response.TryCast (typeof (string));
    System.Diagnostics.Debug.WriteLine (&quot;Result: &quot; + result);
}
</pre>
<p>You try to cast the response into a string, if it cannot be casted you get back a null or the default value for value types.  TryCast is pretty powerful, you can declare a class and have TryCast map the returned struct (associative array) to that class.  E.g. lets say we have this fault class:</p>
<pre class="brush: csharp;">
public class Fault {
    public int FaultCode;
    public string FaultString;

    public override string  ToString() {
                 return &quot;Fault Code: &quot; + FaultCode.ToString ()
                     + &quot;, Fault String: &quot; + FaultString;
    }
}
</pre>
<p>You can use <i>TryCast</i> to map a fault response to this class.  Note that, the names of the members here actually match with those returned when a fault occurs (see <a href="http://www.xmlrpc.com/spec">XML-RPC spec</a>), case is not important though.  You can use your own classes to map with struct returned as XML-RPC responses, this should be pretty handy.  I will include more details when I actually release the library.  </p>
<p>So a more fault tolerant event handler would look something like this:</p>
<pre class="brush: csharp;">
Fault f = (Fault)response.TryCast (typeof (Fault));
if (f != null) {
    Debug.WriteLine (&quot;Fault occured: &quot; + f.ToString ());
    if (f.FaultCode == -1) {
        Debug.WriteLine (&quot;OMG! -1 ERROR!&quot;);
    }
}
else {
    string result = (string)response.TryCast (typeof (string));
    Debug.WriteLine (&quot;Result: &quot; + result);
}
</pre>
<p>I am still working on a few things with this library, I will post it up here as soon as I am done, I promise!</p>
<p>Stay tuned!</p>
<p>/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.soundc.de/blog/2009/01/28/xml-rpc-for-silverlight/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

