Consuming HTTP Services

Android applications and mobile applications in general are small apps with a lot of functionality. One of the ways that mobile apps deliver such rich functionality on such a small device is that they pull information from various sources. For example, the T-Mobile G1 comes with the Maps application, which provides seemingly sophisticated mapping functionality. We, however, know that the application is integrated with Google Maps and other services, which provide most of the sophistication.

That said, it is likely that the applications you write will also leverage information from other applications. A common integration strategy is to use HTTP. For example, you might have a Java servlet that provides services you want to leverage from one of your Android applications. How do you do that with Android? Interestingly, the Android SDK ships with Apache's HttpClient (http://hc.apache.org/httpclient-3.x7), which is universally used within the J2EE space. The Android SDK ships with a version of the HttpClient that has been modified for Android, but the APIs are very similar to the APIs in the J2EE version.

The Apache HttpClient is a comprehensive HTTP client. Although it offers full support for the HTTP protocol, you will likely utilize HTTP GET and POST. In this section, we will discuss using the HttpClient to make HTTP GET and HTTP POST calls.

Easy Software Profits

Easy Software Profits

Here's How Anyone Can Start, Build and Run their Own Successful Software Empire Without Knowing the First Thing About Programming, Scripting Or Any 'Coder' Stuff. There is no doubt about it software sells. Software has a high percieved value and it solves problems for people.  A claim that can't always be made for PDF books, Video products and the like.

Get My Free Ebook


Post a comment