Chapter 14. Using the Silverlight Communication Framework

Silverlight 2 provides a fairly robust communication framework to communicate with Web services and retrieve remote resources. The combination of the Silverlight communication framework and data framework, discussed in the next chapter, provides Silverlight applications with the ability to interact with a wide variety of Web services based on RSS, JSON, REST, SOAP, and other technologies.

The Silverlight communication framework can be broken down into three pieces: the WebClient class, HTTP classes, and sockets. Each of these frameworks has advantages over the others and is used for different purposes.

The WebClient interface is the simplest to implement and can be used to download remote resources or data from Web services. The Socket library provides the tools necessary for Silverlight applications to interact with TCP-based Web services. The HttpWebRequest and HttpWebResponse classes are more complex; however, they provide much more control when interacting with Web services.

Note

In Chapter 10, we discuss setting up ASP.NET Web services to work with Silverlight applications and how to access them using a SOAP client. That is part of the communication framework; however, we don't discuss it in this chapter because it has already been covered.

The Silverlight communication framework does support cross-domain access to Web services and resources. However, cross-domain access is tightly governed using access policies. This protects ...

Get Silverlight™ 2 Bible 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.