SlideShare a Scribd company logo
[email_address]
Hot New Technology World Wide Web – WWW Web 3.0 Rise of the Machines!!! [email_address]
Web services  Web services – Websites for programs [email_address]
Common  Web Services Flickr Amazon Twitter Youtube Ebay Google search, maps, etc. Meetup Thousands of others [email_address]
2 basic styles of services Service Oriented Architectures – (Distributed Objects) CORBA, SOAP, XML-RPC, COM Resource Oriented Architectures Resources can be anything REST – use simple web based technologies HTTP URI XML (or Json, xhtml, text, plists, etc.) [email_address]
HTTP Methods: GET, POST, PUT, DELETE, HEAD Parameters in URL or Body Return codes: 200, 404, 500, etc. Headers: Cache, Authentication, etc. [email_address]
URI / URL Addressability Connectedness Uniformity Hierarchical [email_address]
Content Format up to the designer XML JSON – especially for AJAX XHTML Can support multiple formats [email_address]
Steps for using a RESTful service Gather information - URI, Method, Params Make HTTP Request Parse Result [email_address]
1) Gather information Study the API http://www.meetup.com/meetup_api/docs/ Decide what you want to do: Ie. Get a list of meetups near me. http://api.meetup.com/events.xml/?lat=40.743348&lon=-73.993525&radius=1&key=123 [email_address]
Result (part 1) <results> <head> <count>200</count> <total_count>1274</total_count> <updated>Mon Aug 25 20:10:21 EDT 2008</updated> <description>API method for accessing meetup events</description> <lat>40.743348</lat> <id/> <method>Events</method> <lon>-73.993525</lon> <title>Meetup Events</title> <next> http://api.meetup.com/events/ ?...  </next> <link>http://api.meetup.com/events/</link> <url> http://api.meetup.com/events/ ? … </url> </head> [email_address]
Result (part 2) <items> <item> <lon>-73.98999786376953</lon> <rsvpcount>3</rsvpcount> <group_name>Better Laugh Laughter Yoga</group_name> <lat>40.7400016784668</lat> <feecurrency>USD</feecurrency> <time>Mon Aug 25 19:30:00 EDT 2008</time> <event_url>http://stress.meetup.com/12/calendar/8385325</event_url> <attendee_count>0</attendee_count> <id>8385325</id> <venue_lon/> <fee>0.0</fee> <venue_name/> <venue_lat/> <description/> <photo_url> http://photos1.meetupstatic.com/photos/event/1/6/4/b/global_3743707.jpeg </photo_url> <updated>Mon Jul 21 20:35:17 EDT 2008</updated> <feedesc/> <questions/> <name>Better Laugh Laughter Yoga Meetup</name> </item> [email_address]
2) Make HTTP Request Encode parameters URL or body Specify method Manipulate headers Example: Simple GET in your browser or use curl curl &quot;http://api.meetup.com/groups/?zip=10003&key=123” [email_address]
Simplest way in Objective-C NSString *urlString =  @&quot;http://api.meetup.com/…”; NSURL *url = [NSURL URLWithString:urlString]; NSStringEncoding encoding; NSError *error; NSString *doc = [NSString stringWithContentsOfURL:url  usedEncoding:&encoding error:&error]; [email_address]
More control NSURLResponse *response; NSError *error; NSMutableURLRequest *urlRequest =  [NSMutableURLRequest requestWithURL:url]; // Manipulate the request NSData *urlData = [NSURLConnection  sendSynchronousRequest:urlRequest  returningResponse:&response error:&error]; [email_address]
Asynchronous way NSURLConnection *connection = [NSURLConnection connectionWithRequest:urlRequest delegate:self];  // start ‘progress’ animation -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [myData appendData:data]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { // stop ‘progress’ animation and use data. } [email_address]
Homework Extract this all out into a reusable web services client class that Sets parameters and body based on HTTP method Makes asynchronous calls and collects data Calls back arbitrary methods on delegate Load images asynchronously also Hints: SEL/performSelector, also check out twitter engine [email_address]
3) Parse Results NSXMLParser -  SAX based parsing NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; [parser setDelegate:self]; [parser parse]; parser: didStartElement: namespaceURI: qualifiedName: attributes: parser: didEndElement: namespaceURI: qualifiedName: parser: foundCharacters: [email_address]
Other Options Libxml2 http://code.google.com/p/touchcode/wiki/TouchXML http://code.google.com/p/touchcode/wiki/TouchJSON P Lists – NSPropertyListSerialization propertyListFromData [email_address]
Things to look out for Bugs in client libraries - sometimes PUT and DELETE are not well supported Debugging the HTTP request response can be trying. Anyone know of a good debugging proxy? [email_address]
Resources programmableweb.com Code besides twitter engine? For REST info check out: [email_address]
Questions? Slides will be on  http://www.E-String.com Feel free to contact me: Julio Barros 917-445-7264 [email_address] [email_address]

More Related Content

PDF
mobile in the cloud with diamonds. improved.
PPT
Connecting to a REST API in iOS
PPTX
Using Webservice in iOS
PDF
Difference between xml and json
PDF
Client Server Communication on iOS
PDF
iOS: Web Services and XML parsing
PDF
Angular - Chapter 7 - HTTP Services
PPT
mobile in the cloud with diamonds. improved.
Connecting to a REST API in iOS
Using Webservice in iOS
Difference between xml and json
Client Server Communication on iOS
iOS: Web Services and XML parsing
Angular - Chapter 7 - HTTP Services

What's hot (20)

PPTX
Node js crash course session 3
PPTX
Web Technologies - forms and actions
PPTX
Node js crash course session 5
PDF
Angular - Chapter 9 - Authentication and Authorization
PDF
FITC presents: Mobile & offline data synchronization in Angular JS
PPTX
Introduction about-ajax-framework
PDF
Getting started with MongoDB and Scala - Open Source Bridge 2012
PDF
Dynamic content generation
PDF
Scala with mongodb
PDF
Elastic Search
PDF
Angular - Chapter 6 - Firebase Integration
PDF
Electron, databases, and RxDB
PDF
Change RelationalDB to GraphDB with OrientDB
PDF
AJAX - An introduction
PDF
Dcm#8 elastic search
PDF
HTML5 - An introduction
PDF
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
PPTX
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
PPT
Easy javascript
Node js crash course session 3
Web Technologies - forms and actions
Node js crash course session 5
Angular - Chapter 9 - Authentication and Authorization
FITC presents: Mobile & offline data synchronization in Angular JS
Introduction about-ajax-framework
Getting started with MongoDB and Scala - Open Source Bridge 2012
Dynamic content generation
Scala with mongodb
Elastic Search
Angular - Chapter 6 - Firebase Integration
Electron, databases, and RxDB
Change RelationalDB to GraphDB with OrientDB
AJAX - An introduction
Dcm#8 elastic search
HTML5 - An introduction
Going fullstack React(ive) - Paulo Lopes - Codemotion Amsterdam 2017
Internet and Web Technology (CLASS-10) [Node.js] | NIC/NIELIT Web Technology
Easy javascript
Ad

Viewers also liked (15)

PDF
iOS APP Development - Network Service
PDF
iOSハンズオントレーニング通信(NSURLConnection/NSURLSession)編
PDF
Programming in Objective-C
PDF
Objective-C @ ITIS
PPT
Objective-C for iOS Application Development
PDF
iOS 101 - Xcode, Objective-C, iOS APIs
KEY
Objective-C Crash Course for Web Developers
PDF
Advanced iOS
PDF
iOS Development - A Beginner Guide
PDF
Iphone programming: Objective c
PDF
REST to RESTful Web Service
PDF
Web Services
PPTX
JSON: The Basics
PPT
Web Service Presentation
PDF
URLSession Reloaded
iOS APP Development - Network Service
iOSハンズオントレーニング通信(NSURLConnection/NSURLSession)編
Programming in Objective-C
Objective-C @ ITIS
Objective-C for iOS Application Development
iOS 101 - Xcode, Objective-C, iOS APIs
Objective-C Crash Course for Web Developers
Advanced iOS
iOS Development - A Beginner Guide
Iphone programming: Objective c
REST to RESTful Web Service
Web Services
JSON: The Basics
Web Service Presentation
URLSession Reloaded
Ad

Similar to Web Services with Objective-C (20)

PDF
Web Services, for DevDays Belfast
PPTX
Web Programming
ZIP
REST: Theory vs Practice
PPTX
An Overview of Web Services: SOAP and REST
PPTX
Web-Services-web services-20052025-051043pm.pptx
PPT
Design And Implementation Of Web Service Testing Framework Mit Template
PPT
Soap and Rest
PPTX
Introduction to Web Services
PPTX
Http and REST APIs.
PPTX
Restful webservice
PPTX
07 restful webservices design
PPTX
Reto2.011 APEX API
PDF
Web Service and Mobile Integrated Day I
PDF
Web services and Applications in Web Technology.pdf
ZIP
Web Applicaitons - a roller coaster ride
PDF
A2 from soap to rest
PDF
Creating Restful Web Services with restish
PDF
Android App Development 06 : Network &amp; Web Services
KEY
Enter the app era with ruby on rails (rubyday)
PPTX
Web Services, for DevDays Belfast
Web Programming
REST: Theory vs Practice
An Overview of Web Services: SOAP and REST
Web-Services-web services-20052025-051043pm.pptx
Design And Implementation Of Web Service Testing Framework Mit Template
Soap and Rest
Introduction to Web Services
Http and REST APIs.
Restful webservice
07 restful webservices design
Reto2.011 APEX API
Web Service and Mobile Integrated Day I
Web services and Applications in Web Technology.pdf
Web Applicaitons - a roller coaster ride
A2 from soap to rest
Creating Restful Web Services with restish
Android App Development 06 : Network &amp; Web Services
Enter the app era with ruby on rails (rubyday)

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Modernizing your data center with Dell and AMD
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Empathic Computing: Creating Shared Understanding
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Understanding_Digital_Forensics_Presentation.pptx
Approach and Philosophy of On baking technology
Spectral efficient network and resource selection model in 5G networks
Modernizing your data center with Dell and AMD
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
NewMind AI Weekly Chronicles - August'25 Week I
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
CIFDAQ's Market Insight: SEC Turns Pro Crypto
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?

Web Services with Objective-C

  • 2. Hot New Technology World Wide Web – WWW Web 3.0 Rise of the Machines!!! [email_address]
  • 3. Web services Web services – Websites for programs [email_address]
  • 4. Common Web Services Flickr Amazon Twitter Youtube Ebay Google search, maps, etc. Meetup Thousands of others [email_address]
  • 5. 2 basic styles of services Service Oriented Architectures – (Distributed Objects) CORBA, SOAP, XML-RPC, COM Resource Oriented Architectures Resources can be anything REST – use simple web based technologies HTTP URI XML (or Json, xhtml, text, plists, etc.) [email_address]
  • 6. HTTP Methods: GET, POST, PUT, DELETE, HEAD Parameters in URL or Body Return codes: 200, 404, 500, etc. Headers: Cache, Authentication, etc. [email_address]
  • 7. URI / URL Addressability Connectedness Uniformity Hierarchical [email_address]
  • 8. Content Format up to the designer XML JSON – especially for AJAX XHTML Can support multiple formats [email_address]
  • 9. Steps for using a RESTful service Gather information - URI, Method, Params Make HTTP Request Parse Result [email_address]
  • 10. 1) Gather information Study the API http://www.meetup.com/meetup_api/docs/ Decide what you want to do: Ie. Get a list of meetups near me. http://api.meetup.com/events.xml/?lat=40.743348&lon=-73.993525&radius=1&key=123 [email_address]
  • 11. Result (part 1) <results> <head> <count>200</count> <total_count>1274</total_count> <updated>Mon Aug 25 20:10:21 EDT 2008</updated> <description>API method for accessing meetup events</description> <lat>40.743348</lat> <id/> <method>Events</method> <lon>-73.993525</lon> <title>Meetup Events</title> <next> http://api.meetup.com/events/ ?... </next> <link>http://api.meetup.com/events/</link> <url> http://api.meetup.com/events/ ? … </url> </head> [email_address]
  • 12. Result (part 2) <items> <item> <lon>-73.98999786376953</lon> <rsvpcount>3</rsvpcount> <group_name>Better Laugh Laughter Yoga</group_name> <lat>40.7400016784668</lat> <feecurrency>USD</feecurrency> <time>Mon Aug 25 19:30:00 EDT 2008</time> <event_url>http://stress.meetup.com/12/calendar/8385325</event_url> <attendee_count>0</attendee_count> <id>8385325</id> <venue_lon/> <fee>0.0</fee> <venue_name/> <venue_lat/> <description/> <photo_url> http://photos1.meetupstatic.com/photos/event/1/6/4/b/global_3743707.jpeg </photo_url> <updated>Mon Jul 21 20:35:17 EDT 2008</updated> <feedesc/> <questions/> <name>Better Laugh Laughter Yoga Meetup</name> </item> [email_address]
  • 13. 2) Make HTTP Request Encode parameters URL or body Specify method Manipulate headers Example: Simple GET in your browser or use curl curl &quot;http://api.meetup.com/groups/?zip=10003&key=123” [email_address]
  • 14. Simplest way in Objective-C NSString *urlString = @&quot;http://api.meetup.com/…”; NSURL *url = [NSURL URLWithString:urlString]; NSStringEncoding encoding; NSError *error; NSString *doc = [NSString stringWithContentsOfURL:url usedEncoding:&encoding error:&error]; [email_address]
  • 15. More control NSURLResponse *response; NSError *error; NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:url]; // Manipulate the request NSData *urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error]; [email_address]
  • 16. Asynchronous way NSURLConnection *connection = [NSURLConnection connectionWithRequest:urlRequest delegate:self]; // start ‘progress’ animation -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [myData appendData:data]; } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { // stop ‘progress’ animation and use data. } [email_address]
  • 17. Homework Extract this all out into a reusable web services client class that Sets parameters and body based on HTTP method Makes asynchronous calls and collects data Calls back arbitrary methods on delegate Load images asynchronously also Hints: SEL/performSelector, also check out twitter engine [email_address]
  • 18. 3) Parse Results NSXMLParser - SAX based parsing NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data]; [parser setDelegate:self]; [parser parse]; parser: didStartElement: namespaceURI: qualifiedName: attributes: parser: didEndElement: namespaceURI: qualifiedName: parser: foundCharacters: [email_address]
  • 19. Other Options Libxml2 http://code.google.com/p/touchcode/wiki/TouchXML http://code.google.com/p/touchcode/wiki/TouchJSON P Lists – NSPropertyListSerialization propertyListFromData [email_address]
  • 20. Things to look out for Bugs in client libraries - sometimes PUT and DELETE are not well supported Debugging the HTTP request response can be trying. Anyone know of a good debugging proxy? [email_address]
  • 21. Resources programmableweb.com Code besides twitter engine? For REST info check out: [email_address]
  • 22. Questions? Slides will be on http://www.E-String.com Feel free to contact me: Julio Barros 917-445-7264 [email_address] [email_address]