SlideShare a Scribd company logo
Connecting to
Web Services on Android




       Sean Sullivan
       June 2, 2010
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
Connecting to Web Services on Android June 2 2010
HTTP request


HTTP response
Connecting to Web Services on Android June 2 2010
•   HTTP
•   XML
•   JSON
•   OAuth
+ HTTP
Option 1
  • java.net.URL
  • java.net.HttpURLConnection
Option 2
  • HttpClient 4.0 API
HttpClient 4.0 API


•   org.apache.http.client.HttpClient
•   org.apache.http.impl.client.DefaultHttpClient
HttpClient 4.0 API

• org.apache.http.client.methods.HttpGet
• org.apache.http.client.methods.HttpPost
• org.apache.http.client.methods.HttpPut
• org.apache.http.client.methods.HttpDelete
HttpClient 4.0 API

•   org.apache.http.HttpResponse
•   org.apache.http.StatusLine
•   org.apache.http.HttpEntity
•   org.apache.http.utils.EntityUtils
HttpClient programming

• HTTP response status code
• I/O exceptions
• timeouts
• gzip
HttpClient programming

synchronous invocation
  public HttpResponse execute(HttpUriRequest request)




asynchronous invocation
  public HttpResponse execute(HttpUriRequest request,

                             ResponseHandler handler)
UI programming

• user clicks on button
• onClick listener
• Don’t block the UI thread!
• Tip: use java.lang.Runnable
Response formats

• XML
• JSON
• RSS, Atom
• other
JSON processing
• json.org package
• Google GSON library
• XStream + Jettison
                   *


• json-lib
        *




                        * does not work on Android 1.x
XML processing
• org.w3c.dom package (DOM)
• org.xml.sax package (SAX)
• org.xmlpull package (XPP)
• XStream
• JDOM
• Apache XmlBeans*

                         * does not work on Android 1.x
RSS and Atom

• Rome library *
• Apache Abdera library   *




                              * does not work on Android 1.x
Client libraries

    code.google.com/p/jfireeagle

    code.google.com/p/jpoco

    code.google.com/p/meetup-java-client
Client libraries
  code.google.com/p/gdata-java-client


  code.google.com/p/upcoming-java-client


  flickrj.sourceforge.net
Connecting to Web Services on Android June 2 2010
Conclusion

• HttpClient API
• use XStream for XML processing
• use Google GSON for JSON processing
• OAuth has a learning curve
Thank you

More Related Content

What's hot (20)

PDF
Building Next Generation Real-Time Web Applications using Websockets
Naresh Chintalcheru
 
PDF
AtlasCamp 2014: Building a Connect Add-on With Your Own Stack
Atlassian
 
PDF
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
PDF
Bug Bounty Hunter Methodology - Nullcon 2016
bugcrowd
 
PPTX
An introduction to PhantomJS: A headless browser for automation test.
BugRaptors
 
PDF
How do I Write Testable Javascript so I can Test my CF API on Server and Client
ColdFusionConference
 
PPTX
Vulnerability intelligence with vulners.com / Кирилл Ермаков, Игорь Булатенко...
Ontico
 
PPTX
Александр Сергиенко, Senior Android Developer, DataArt
Alina Vilk
 
ODP
Real time web (Orbited) at BCNE3
Alex Kavanagh
 
PDF
Web Exploitation
UTD Computer Security Group
 
PPTX
How to build a container monitoring solution - David Gildeh, CEO and Co-Found...
Outlyer
 
PPTX
Web backends development using Python
Ayun Park
 
PPT
Bigger Stronger Faster
Chris Love
 
PDF
AtlasCamp 2014: Static Connect Add-ons
Atlassian
 
PDF
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Fwdays
 
PDF
Introduction to Retrofit
Kazuhiro Serizawa
 
PDF
Building RESTful APIs
Silota Inc.
 
PPTX
HTTPS and HTTP/2
MatthewWalker9
 
PDF
Detecting headless browsers
Sergey Shekyan
 
Building Next Generation Real-Time Web Applications using Websockets
Naresh Chintalcheru
 
AtlasCamp 2014: Building a Connect Add-on With Your Own Stack
Atlassian
 
Profiling PHP with Xdebug / Webgrind
Sam Keen
 
Bug Bounty Hunter Methodology - Nullcon 2016
bugcrowd
 
An introduction to PhantomJS: A headless browser for automation test.
BugRaptors
 
How do I Write Testable Javascript so I can Test my CF API on Server and Client
ColdFusionConference
 
Vulnerability intelligence with vulners.com / Кирилл Ермаков, Игорь Булатенко...
Ontico
 
Александр Сергиенко, Senior Android Developer, DataArt
Alina Vilk
 
Real time web (Orbited) at BCNE3
Alex Kavanagh
 
Web Exploitation
UTD Computer Security Group
 
How to build a container monitoring solution - David Gildeh, CEO and Co-Found...
Outlyer
 
Web backends development using Python
Ayun Park
 
Bigger Stronger Faster
Chris Love
 
AtlasCamp 2014: Static Connect Add-ons
Atlassian
 
Alexander Mostovenko "'Devide at impera' with GraphQL and SSR"
Fwdays
 
Introduction to Retrofit
Kazuhiro Serizawa
 
Building RESTful APIs
Silota Inc.
 
HTTPS and HTTP/2
MatthewWalker9
 
Detecting headless browsers
Sergey Shekyan
 

Similar to Connecting to Web Services on Android June 2 2010 (20)

PDF
Connecting to-web-services-on-android-4577
sharvari123
 
KEY
Android lessons you won't learn in school
Michael Galpin
 
PDF
マイクロサービスバックエンドAPIのためのRESTとgRPC
disc99_
 
PDF
Barcamp Bangkhen :: Robot Framework
Somkiat Puisungnoen
 
PDF
Introduction to Robot Framework
Somkiat Puisungnoen
 
PDF
DanNotes 2013: OpenNTF Domino API
Paul Withers
 
PDF
End-to-end W3C APIs - tpac 2012
Alexandre Morgaut
 
PDF
Middleware in Golang: InVision's Rye
Cale Hoopes
 
PPTX
In-browser storage and me
Jason Casden
 
PPTX
Lecture05.pptx
MrVMNair
 
PDF
How to Contribute to Apache Usergrid
David M. Johnson
 
PPTX
automated-automation-of-rest-apis.pptx
Aditya274010
 
PDF
Maine WordPress Meetup JSON REST API, 3/16/2016
Andre Gagnon
 
KEY
Inside Of Mbga Open Platform
Hideo Kimura
 
PDF
Building Awesome APIs with Lumen
Kit Brennan
 
PDF
01/2009 - Portral development with liferay
daveayan
 
PPTX
Java scriptwidgetdevelopmentjstanbul2012
Volkan Özçelik
 
PPTX
External JavaScript Widget Development Best Practices
Volkan Özçelik
 
PPTX
External JavaScript Widget Development Best Practices (updated) (v.1.1)
Volkan Özçelik
 
PDF
API Design & Security in django
Tareque Hossain
 
Connecting to-web-services-on-android-4577
sharvari123
 
Android lessons you won't learn in school
Michael Galpin
 
マイクロサービスバックエンドAPIのためのRESTとgRPC
disc99_
 
Barcamp Bangkhen :: Robot Framework
Somkiat Puisungnoen
 
Introduction to Robot Framework
Somkiat Puisungnoen
 
DanNotes 2013: OpenNTF Domino API
Paul Withers
 
End-to-end W3C APIs - tpac 2012
Alexandre Morgaut
 
Middleware in Golang: InVision's Rye
Cale Hoopes
 
In-browser storage and me
Jason Casden
 
Lecture05.pptx
MrVMNair
 
How to Contribute to Apache Usergrid
David M. Johnson
 
automated-automation-of-rest-apis.pptx
Aditya274010
 
Maine WordPress Meetup JSON REST API, 3/16/2016
Andre Gagnon
 
Inside Of Mbga Open Platform
Hideo Kimura
 
Building Awesome APIs with Lumen
Kit Brennan
 
01/2009 - Portral development with liferay
daveayan
 
Java scriptwidgetdevelopmentjstanbul2012
Volkan Özçelik
 
External JavaScript Widget Development Best Practices
Volkan Özçelik
 
External JavaScript Widget Development Best Practices (updated) (v.1.1)
Volkan Özçelik
 
API Design & Security in django
Tareque Hossain
 
Ad

More from sullis (20)

PDF
Getting started with MongoDB and Scala - Open Source Bridge 2012
sullis
 
PDF
Production Ready Web Services with Dropwizard
sullis
 
PDF
Incremental deployment of new features
sullis
 
PDF
Comparing JSON Libraries - July 19 2011
sullis
 
PDF
Android - Open Source Bridge 2011
sullis
 
PDF
Android 3.1 - Portland Code Camp 2011
sullis
 
PDF
Android 3.0 Portland Java User Group 2011-03-15
sullis
 
PDF
GWT 2.0 - OSCON 2010
sullis
 
PDF
Programming WebSockets - OSCON 2010
sullis
 
PDF
Programming WebSockets - April 20 2010
sullis
 
PDF
WebDAV - April 15 2008
sullis
 
PDF
GWT 2.0 - December 15 2009
sullis
 
PDF
Google App Engine - September 17 2009
sullis
 
PDF
Google App Engine - Portland Java User Group - August 18 2009
sullis
 
PDF
Domo Arigato Mr. Roboto - Open Source Bridge 2009
sullis
 
PDF
Java and JSON - UJUG - March 19 2009
sullis
 
PDF
OAuth and REST web services
sullis
 
PDF
Introduction to Android - Mobile Fest Singapore 2009
sullis
 
PDF
Getting Started with Android - OSSPAC 2009
sullis
 
PDF
Introduction to Android - Mobile Portland
sullis
 
Getting started with MongoDB and Scala - Open Source Bridge 2012
sullis
 
Production Ready Web Services with Dropwizard
sullis
 
Incremental deployment of new features
sullis
 
Comparing JSON Libraries - July 19 2011
sullis
 
Android - Open Source Bridge 2011
sullis
 
Android 3.1 - Portland Code Camp 2011
sullis
 
Android 3.0 Portland Java User Group 2011-03-15
sullis
 
GWT 2.0 - OSCON 2010
sullis
 
Programming WebSockets - OSCON 2010
sullis
 
Programming WebSockets - April 20 2010
sullis
 
WebDAV - April 15 2008
sullis
 
GWT 2.0 - December 15 2009
sullis
 
Google App Engine - September 17 2009
sullis
 
Google App Engine - Portland Java User Group - August 18 2009
sullis
 
Domo Arigato Mr. Roboto - Open Source Bridge 2009
sullis
 
Java and JSON - UJUG - March 19 2009
sullis
 
OAuth and REST web services
sullis
 
Introduction to Android - Mobile Fest Singapore 2009
sullis
 
Getting Started with Android - OSSPAC 2009
sullis
 
Introduction to Android - Mobile Portland
sullis
 
Ad

Recently uploaded (20)

PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
“Voice Interfaces on a Budget: Building Real-time Speech Recognition on Low-c...
Edge AI and Vision Alliance
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
MuleSoft MCP Support (Model Context Protocol) and Use Case Demo
shyamraj55
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 

Connecting to Web Services on Android June 2 2010