Referencing an ASMX Web Service

Before you can use the service, the Silverlight client application must add a service reference to the ASMX web service that was created. You can add a service reference by going to the Project Explorer, right-clicking the Service Reference node for the SilverlightEmailClient project, and selecting the Add Service Reference menu option. A window will open, which you can use to search for (or discover) any services available on the computer. Alternatively, you can enter a URL to a specific web service. Because the EmailService.asmx service is on the same computer as this solution, you can click the Discover button. After a few moments, the Silverlight 2 client application will find the EmailService.asmx service and you can select it. This window will search for any service that exposes Web Services Description Language (WSDL), which makes it discoverable. Both WCF web services and ASMX web services support SOAP 1.1 and are discoverable, so you can find them through this window.

You can add as a service reference from a Silverlight 2 application any SOAP service that is discoverable and supports the basic profile of SOAP 1.1. Discoverable services are those that support WSDL. These include both WCF services and ASMX services, as shown in this chapter. You can access services that do not describe themselves (such as REST, POX, and RSS) via WebClient and HttpWebRequest, which we will discuss in later chapters.

Figure 5-4 shows the EmailService.asmx service ...

Get Data-Driven Services with Silverlight 2 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.