Chapter 15. Enabling Networking
While there are many applications that function without the need to access data from a source other than files held within isolated storage in the phone's memory, your application may at some point need to post or retrieve data from a web service. We will look at how you can use the phone's built-in networking capabilities to access data from the Internet.
With Windows Phone 7 you can access ASMX, REST, and Windows Azure web services. While the underlying principles for accessing these three types of web services are for the most part very similar, there are some important differences in how you will write code to access them.
ASMX web services have been a part of the .NET Framework since its initial release in February 2002, providing a simple way to allow client applications to access data over the Internet. The means that you will use to access an ASMX web service from a Windows Phone 7 application is quite similar to the means you may already be familiar with using to access these services from a web page or desktop application. The steps are as follows:
Create a web reference.
Instantiate a new instance of the web service.
Call the web service.
Bind values from the returned XML to corresponding objects.
For this lesson you will learn how to consume the CurrencyConvertor web service from the
WebServiceX.net website, which takes as input a From currency and a To currency and returns the current exchange rate. The
WebServiceX.net website provides ...