Reading data from a REST service

Let's assume that we are writing a Silverlight application that needs to work with data exposed by a RESTful service. The first question that comes to mind is: how can we communicate with such a service and read out the data returned by the service?

This recipe focuses on the communication aspect of REST services, such as how we can connect to a RESTful service from Silverlight and get data into our application.

In this recipe, we'll retrieve a list of all users in the Users table using a REST service. For now, we'll show the results in the same format as they are returned, which is plain XML.

Getting ready

The finished solution for this recipe can be found in the Chapter08/TalkingToSimpleRESTServices_ReadingFromRest_Completed ...

Get Silverlight 4 Data and Services Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.