• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Web Services and Android - OSSPAC 2009
 

Web Services and Android - OSSPAC 2009

on

  • 8,047 views

Web Services and Android

Web Services and Android
OSSPAC
February 18 2009
Singapore

Statistics

Views

Total Views
8,047
Views on SlideShare
8,010
Embed Views
37

Actions

Likes
0
Downloads
294
Comments
0

2 Embeds 37

http://www.codeandroid.org 30
http://www.slideshare.net 7

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Web Services and Android - OSSPAC 2009 Web Services and Android - OSSPAC 2009 Presentation Transcript

    • Web Services and Android Sean Sullivan OSSPAC 18 February 2009
    • • HTTP • OAuth • XML • JSON
    • +
    • HTTP request XML response
    • + http://code.google.com/p/jfireeagle
    • jfireeagle project • HttpClient API • XStream • OAuth Java library
    • “An open protocol to allow secure API authorization in a simple and standard method from desktop and web applications”
    • • use OAuth to access protected data • your application needs to obtain an access token from the service provider • service provider will issue access token after the user grants permission
    • + http://code.google.com/p/oauth
    • + jfireeagle http://code.google.com/p/jfireeagle/wiki/Android jpoco http://code.google.com/p/jpoco/wiki/Android
    • + 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
    • 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.0 or 1.1
    • JSON processing • org.json package • Google GSON library * • XStream + Jettison * • json-lib * * does not work on Android 1.0 or 1.1
    • RSS and Atom • Rome library * • Apache Abdera library * * does not work on Android 1.0 or 1.1
    • 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
    • Conclusion • HttpClient API • use XStream for XML processing • use org.json package for JSON processing • OAuth has a learning curve
    • Thank you
    • Resources • http://code.google.com/android/documentation.html • http://hc.apache.org/httpcomponents-client • http://code.google.com/p/oauth • http://xstream.codehaus.org