This is not a recipe but rather a complete application, as it addresses all at once a variety of issues found in the real world of dealing with RESTful web services.
Years ago, Google used to publish SOAP-based APIs to let developers work with different aspects of its platform. It has since deprecated those web services in favor of RESTful APIs. You can interact with Google in lots of ways with REST, including interacting with Blogger, Feedburner, AdSense, Calendar, CheckOut, Maps, OpenSocial, YouTube, Earth, Search, and lots more. To see a complete list, visit http://code.google.com and click “APIs & Tools.”
In this application, you’ll address several things at once:
Interacting with a real-world RESTful web service that goes well beyond “Hello World.” In this example, you’ll use the Google Finance API to authenticate and get a user token, create a new portfolio, and read the list of portfolios associated with an account.
Working with the Atom Publishing Protocol, which has grown into a popular way to implement REST.
Using a secure socket to communicate over SSL with a RESTful service.
Interacting with a RESTful service across multiple invocations in a “session.”
Authenticating using raw HTTP.
Working at a low level to establish connections at the socket layer in the absence of a framework.
Reading and writing data using GET and POST in REST.
Dealing with some of the issues of working with services in the absence of ...