Data-Driven Services with Silverlight 2

John Papa

Mentioned 2

This comprehensive book teaches you how to build data-rich business applications with Silverlight 2 that draw on multiple sources of data. Packed with reusable examples, Data-Driven Services with Silverlight 2 covers all of the data access and web service tools you need, including data binding, the LINQ data querying component, RESTful and SOAP web service support, cross-domain web service calls, and Microsoft's new ADO.NET Data Services and the ADO.NET Entity Framework. With this book, you will: Know when and how to use LINQ to JSON, LINQ to XML, and LINQ to Objects Learn how Silverlight 2 applications bind, pass, read, save, query, and present data Discover how your application can call web services to work with SOAP, REST, RSS, AtomPub, POX and JSON Design REST, ASMX, and WCF web services that communicate with Silverlight 2 Harness RESTful web services such as Digg, Amazon, and Twitter Retrieve and save data using the new Entity Framework and WCF Work with RESTful ADO.NET Data Services and its Silverlight client library to move data between your Silverlight application and a database Data-Driven Services with Silverlight 2 offers many tips and tricks for building data-rich business applications, and covers the scenarios you're most likely to encounter. Complete examples in C# and VB can be downloaded from the book's companion website.

More on

Mentioned in questions and answers.

Im calling a locally hosted wcf service from silverlight and I get the exception below.

Iv created a clientaccesspolicy.xml, which is situated in the route of my host.

<?xml version="1.0" encoding="utf-8"?>
      <allow-from http-request-headers="*">
        <domain uri="*"/>
        <resource path="/" include-subpaths="true"/>

An error occurred while trying to make a request to URI 'http://localhost:8005/Service1.svc'. This could be due to a cross domain configuration error. Please see the inner exception for more details. --->

{System.Security.SecurityException ---> System.Security.SecurityException: Security error. at MS.Internal.InternalWebRequest.Send() at System.Net.BrowserHttpWebRequest.BeginGetResponseImplementation() at System.Net.BrowserHttpWebRequest.InternalBeginGetResponse(AsyncCallback callback, Object state) at System.Net.AsyncHelper.<>c__DisplayClass4.b__3(Object sendState) --- End of inner exception stack trace --- at System.Net.AsyncHelper.BeginOnUI(BeginMethod beginMethod, AsyncCallback callback, Object state) at System.Net.BrowserHttpWebRequest.BeginGetResponse(AsyncCallback callback, Object state) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteSend(IAsyncResult result) at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.OnSend(IAsyncResult result)}

Any ideas on how to progress?

I found the book, Data-Driven Services with Silverlight 2 by John Papa to go over this extensively. I had the same issues and this excellent book explains it all.

I am starting to put together a system architecture document for a new project at my company. Basically we have a rather large business layer that follows the enterprise library data pattern, and i will need to access these data objects from a new silverlight application.

My question is what is the best way to gain access to these objects in silverlight? My initial idea is using WCF, but i am unsure of how to best to reconstruct the objects in the client.

Check out this book, Data-Driven Services with Silverlight 2. I found this to be the best resource for figuring this out. What I did was create a lightweight WCF layer that retrieves objects from an existing DAL and then passes those objects back to the client.