Chapter 28. Web Services

Web services are getting a lot of hype. In the end, however, a Web service is just an HTTP request and response where each may be carrying XML data (Figure 28.1). So using a Web service from Cocoa is simply a matter of being able to send HTTP requests and receive responses and it also may require generating and parsing XML or JSON.

Figure 28.1. Your Average Web Service in Action


HTTP requests and responses are handled by NSURL, NSURLRequest, and NSURLConnection (Figure 28.2).

Figure 28.2. Classes for Making HTTP Requests

Generating and parsing XML is typically done in one of two ways. The high-level method is to use ...

Get Cocoa® Programming for Mac® OS X, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.