Chapter 5. WCF, Web Services, and Cross-Domain Policies

Silverlight 2 brings a tremendous number of tools to the client for creation of rich user interfaces. It also has the ability to consume a variety of services across a network or the Internet. The ability to communicate with different types of web services in different ways (through RESTful services, syndicated feeds, and SOAP services, to name a few) allows Silverlight 2 applications to take advantage of the features these services expose. Silverlight 2 clients provide a robust user experience, and the ability to interact with a variety of services makes Silverlight 2 a great choice for interactive and service-based applications.

This chapter will discuss and demonstrate how to create ASMX web services and Windows Communication Foundation (WCF) web services, and how to communicate with them from a Silverlight 2 client application. First you will create a SOAP-based ASMX service, referenced and consumed from a Silverlight 2 application. I will demonstrate several aspects of service-based communication, including how to set up asynchronous communication from Silverlight 2 clients to ASMX and WCF services, implement handlers, consume results, and handle exceptions. This chapter will also discuss how Silverlight 2 clients can create and consume WCF services, and will demonstrate some of the ways in which data can be passed to and from these services. Figure 5-1 shows the discoverable services and that Silverlight 2 can communicate ...

Get Data-Driven Services with Silverlight 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.