By: Aaron Hillegass
Web services are simply an HTTP request and response whereby each may be carrying XML data. So using a Web service from Cocoa is simply a matter of being able to send HTTP requests and receive responses. It also may require generating and parsing XML.
Figure: Your Average Web Service in Action
HTTP requests and responses are handled by NSURL, NSURLRequest, and NSURLConnection.
Generating and parsing XML are typically done by NSXMLDocument and NSXMLNode. Suppose that you have an NSData containing this XML:
<?xml version="1.0" encoding="UTF-8"?> <person> <first>Larry</first> <last>Furg</last> </person>
NSXMLDocument will parse it into a handy tree.
Figure: Parsed XML Document
Most Viewed Articles (in Cocoa )
Latest Articles (in Cocoa)
Comment on this tutorial
- Data Science
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews