Wednesday, February 18, 2009

Accessing SQL Data Services from Silverlight


“OneNote on Cloud”…  This is something I have started exploring on since last couple of days. 
The idea is to have a OneNote type application experience on web, using Silverlight and SQL Data Services.

The first hurdle was to access SDS from silverlight. We can’t directly use the SDS from silverlight because of some known limitations. So the option that I thought of was to use some Proxy Services in between the Silverlight Client and SDS, which was also suggested by the guys who developed the Omega.SDSClient

Now there are few gotchas while developing these proxy services for silverlight client which I am listing below :

  1. We need to Change the service bindings to ‘basicHttpBinding’ as silverlight doesn’t support any other bindings.
  2. We need to set the AspNetCompatibilityRequirements attribute to ‘Allowed’ for all the service implementations
  3. (If we add the services using the ‘Silverlight-enabled WCF Service’ template than the above changes are done automatically.)
    silverlightenabledservice 
  4. The last thing is to add the cross-domain policy file at the root of in case of IIS hosted services it should be on the root of the mapped directory. 

     crossdomainfile

    The important thing to note in this file is the SOAPAction headers which are required to be enabled for SOAP based messages transfers from silverlight.

No comments:

AddIn