Friday 19 February 2010

WCF and Silverlight development – impressions and usage.

We’ve recently developed a Silverlight based client, and I worked on the backend code for communication between the Silverlight client and the WhosOn server. WhosOn’s general encryption is Public / Private Key to obtain a Session Key, then AES 256 using this session key for normal data.

Silverlight doesn’t currently have support for these areas of the .NET framework, so we were left with 3 choices:

1. TCP + Plain Text

2. TCP + Alternative Encryption

3. Proxied Connection

Using the proxied connection had the advantage of being able to use a more ubiquitous transport, so that we could go through client side proxy servers and avoid other issues with firewalls blocking the non-standard ports.

TCP + Plain Text was ignored due to insecurity, and TCP + Alternative Encryption was discounted due to the lack of any high security protocols in Silverlight.

Next, we had to decide how to write our proxy server. We already have a .NET based class library for connecting to the server, so .NET was the first approach. We looked at creating our own HTTP handling service, or running something through the existing WhosOn Gateway Service which handles simple HTTP requests.

I discovered that WCF had the ability to run through IIS and provide secure connections. Investigating further, I found that you could have an asynchronous subscribe / publish mode as described by Tomasz Janczuk in his blog: http://tomasz.janczuk.org/2009/07/pubsub-sample-using-http-polling-duplex.html

Having looked through his code, and developed our own Subscriber style interface (although at the moment it is the equivalent of each subscriber subscribing to a single topic), we got to our current Silverlight client communication library.

The web services can technically be used by other SOAP supporting clients, and we will be looking at pushing out examples using these.

We ran into a few issues which we haven’t figured out as yet – we’ve had trouble doing an automatic deployment (including installing .net 3.5, registering WCF against IIS, and setting up the application pool), and also the difficulty in allowing the same path to run both secure and insecure versions of the customBinding at the same time.

To have a look at our documentation on it, please see http://www.whoson.com/help/Content/SilverlightClient.htm which includes the installation steps.

1 comment: