Working with WCF for your Silverlight 1.1 Applications

While you can easily use XML web services in your Silverlight applications, working with WCF is much different with the current Silverlight 1.1 September CTP bits. I have done a bit research on the Internet and found a few blogs below that are very helpful.

https://blogs.msdn.com/justinjsmith/archive/2007/07/23/wcf-asp-net-ajax-and-javascript-proxies.aspx
https://www.wintellect.com/cs/blogs/sseely/archive/2007/08/09/accessing-a-wcf-service-from-silverlight.aspx
https://msmvps.com/blogs/luisabreu/archive/2007/06/12/calling-a-wcf-service-from-your-silverlight-application.aspx
https://msmvps.com/blogs/luisabreu/archive/2007/06/13/calling-a-silverlight-wcf-service-part-ii.aspx

All these blogs suggested one option of working with WCF in Silverlight, using Json. After trying several different ways, I was able to put together a working sample and attached it for download. This sample worked on Windows Server 2003 and Windows Server 2008 RC0 with VS.NET 2008 Beta 2 and Silverlight 1.1 September 2007 CTP.

A note: I did try to use WCF without relying on Json. I first created a WCF and host it in IIS. Then I set a web reference to the WCF by pointing to the service.svc url. Behind the scenes the IDE is using the service's wsdl. I then created a Silverlight app, and tried to consume the WCF service in a similar way to what I did with XML web services (using async call). The code didn't return any error, but it did not get any data from the WCF service either. I am trying to figure out if the error was due to data serialization issue, configuration issue, or something else.

wcf json example.zip