O'Reilly logo

Data-Driven Services with Silverlight 2 by John Papa

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 7. Consuming RESTful Services with WebClient and HttpWebRequest

You have many options to consider when working with web services, including the design of a web service, how to pass data between an application and a web service, how to define what type of data is passed, how to invoke the web service, and how to consume the results. An important feature of Silverlight applications is their ability to communicate with web services to send and receive data. Understanding what the options are, how to use them, and how to build custom HTTP-based web services can bring a wide array of flexibility to a Silverlight application.

The previous chapters discussed how to send and receive data with services that describe themselves using SOAP via ASMX and WCF web services. Other variations of HTTP-based web services do not use SOAP, but rather the features inherent to HTTP. This chapter provides a brief but important overview of HTTP web services, their relationship to SOAP-based web services, and the architectural nature of REST-style web services as they relate to being consumed by Silverlight applications. Once these foundations of web services are laid out, the chapter provides examples of how to communicate with them and how they differ.

This chapter also demonstrates how to invoke third-party HTTP web services using WebClient and HttpWebRequest. Once the information has been retrieved from a service, it must be consumed so that it can be used in the Silverlight application. These ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required