O'Reilly logo

Beginning iOS 5 Application Development by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

BASICS OF CONSUMING XML WEB SERVICES

Before you create an Xcode project to consume a Web service, it is good to examine a real Web service to see the different ways you can consume it. My favorite example is to use an ASMX XML Web service created using .NET. For the purposes of this discussion, we'll look at a Web service called CurrencyConvertor, which enables you to convert one currency to another.

The CurrencyConvertor Web service is located at http://www.webservicex.net/currencyconvertor.asmx. If you use Safari to load this URL, you will see that it exposes one Web method: ConversionRate, as shown in Figure 16-1.

image

FIGURE 16-1

The ConversionRate method returns the result (the exchange rate between two specified currencies) as an XML string. Clicking the ConversionRate link reveals the page shown in Figure 16-2.

image

FIGURE 16-2

The important parts are the sections following the Test section shown on the page. They detail the various ways in which you can consume the Web service: SOAP, and optionally, HTTP GET and HTTP POST. In the .NET world, accessing the Web service is a pretty straightforward affair — Visual Studio provides a built-in tool to create a Web proxy service object for the Web service simply by downloading the WSDL document. For iOS development, you need to get your hands ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required