Calling Services Written by Other Developers

Many callable services are available on the Web. Some of these web services are discoverable, such as Live Search, and others are not and use REST, such as Amazon ECS. Most of these services require that a unique key be sent to the service so that the request can be tied back to whoever the key belongs to. Live Search calls its key an AppID.

Note

You can find instructions for creating an AppID for Live Search at http://msdn.microsoft.com/en-us/library/bb266187.aspx. You can find instructions for using the Live Search service at http://msdn.microsoft.com/en-us/library/bb251808.aspx.

The following example shows how you can conduct a simple search using a SOAP-based web service provided by Live Search. First, you must request and use the AppID in the LiveSearchClient sample program included with this chapter. Next, you need to add a service reference to the Live Search service. (You can find this service at http://soap.search.msn.com/webservices.asmx?wsdl.) The sample names the service LiveSearchService, as shown in Figure 5-14.

Referencing Live Search

Figure 5-14. Referencing Live Search

Once the service has been referenced, you can create a proxy to the service and invoke its SearchAsync method. This method requires a SearchRequest parameter, which can include a lot of intricate parameters defining the type of search. This example will keep the search parameters simple ...

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.