Chapter 14. Web Services

WHAT YOU WILL LEARN IN THIS CHAPTER:

  • Understand the various ways to consume Web services in your iPad applications

  • How to communicate with a Web service using SOAP, HTTP GET, and HTTP POST

  • How to parse the result of a Web service call using the NSXMLParser class

Communicating with the outside world is one of the ways to make your iPad applications interesting and useful. This is especially true today when so many Web services provide so much useful functionality. However, consuming Web services in iPad is not for the faint-of-heart. Unlike other development tools (such as Microsoft Visual Studio), Xcode does not have built-in tools that make consuming Web services easy. Everything must be done by hand and you need to know how to form the relevant XML messages to send to the Web services and then parse the returning XML result.

This chapter explains how to communicate with XML Web services from within your iPad application. Using the examples in this chapter, you will have the solid foundation of consuming other Web services that you will need in your own projects.

Note

For an introduction to XML Web services, check out this link: http://www.w3schools.com/webservices/ws_intro.asp.

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 discussion purposes, let's ...

Get Beginning iPad™ Application Development 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.