Over a million developers have joined DZone.
Platinum Partner

Consuming Azure Mobile Services from Android: Part 3

· Cloud Zone

The Cloud Zone is brought to you in partnership with Iron.io. Discover how Microservices have transformed the way developers are building and deploying applications in the era of modern cloud infrastructure.

 Next Steps

  1. The next post will cover these topics:
    • Interacting with Azure Mobile Services using a web proxy client
    • This can give you an in-depth knowlege of REST and HTTP
    • Downloading and configuring Fiddler
    • Using Fiddler to issue GET requests

Previous Posts
Part 1 of 4: Introduction to Consuming Azure Mobile Services from Android http://blogs.msdn.com/b/brunoterkaly/archive/2012/10/03/part-1-of-5-introduction-to-consuming-azure-mobile-services-from-android.aspx
Part 2 of 4: Introduction to Consuming Azure Mobile Services from Android http://blogs.msdn.com/b/brunoterkaly/archive/2012/10/03/part-2-of-5-introduction-to-consuming-azure-mobile-services-from-android.aspx
Part 3 of 4: Introduction to Consuming Azure Mobile Services from Android http://blogs.msdn.com/b/brunoterkaly/archive/2012/10/03/part-3-of-4-introduction-to-consuming-azure-mobile-services-from-android.aspx
Part 4 of 4: Introduction to Consuming Azure Mobile Services from Android http://blogs.msdn.com/b/brunoterkaly/archive/2012/10/03/part-4-of-4-introduction-to-consuming-azure-mobile-services-from-android.aspx
Download Android Source Code https://skydrive.live.com/embed?cid=98B7747CD2E738FB&resid=98B7747CD2E738FB%213151&authkey=AN1ukGyTBgIY76Q
No obligation free trial for Azure Mobile Services http://www.microsoft.com/click/services/Redirect2.ashx?CR_CC=200114759

You will need a trial account for Windows Azure
  1. Please sign up for it here:

Using Fiddler
  1. We want to use Fiddler to look at HTTP requests for the Mobile Service we just created.
    • We should be able to see the two rows of data returned in JSON format.
    • We added:
      • Eat Lunch
      • Finish Blog Post
  2. What is Fiddler?
    • Fiddler is a Web Debugging Proxy which logs all HTTP(S) traffic between your computer and the Internet.
    • Fiddler allows you to inspect traffic, set breakpoints, and fiddle with incoming or outgoing data.
  3. Downloading Fiddler
    • Fiddler can be downloaded here:
      • http://www.fiddler2.com/fiddler2/

Starting Fiddler
  1. From Internet Explorer
  2. From the menu:
    • Choose, TOOLS/FIDDLER
  3. You can also start Fiddler outside of a browser

Properly configuring Fiddler
  1. Note that we need to click
    • Capture HTTPS CONNECTs
    • Decrypt HTTP traffic

Issuing a GET request from Fiddler
  1. This is how data is retrieved from Azure Mobiel Services.
  2. Once in Fiddler, perform the following:
    • Step 1
      • Click the COMPOSER tab
    • Step 2
      • Make sure the GET verb is selected
    • Step 3
      • Type in your URL
        • Yours may differ from mine
    • Step 4
      • Type in the REQUEST HEADER
        • Note the application ID, as specified at the portal
          • X-ZUMO-APPLICATION: QTzCMahnudqOCvnBSEfxdTUdSCqMUQ86
    • Step 5
      • Click EXECUTE

Inspecting the results
  1. Right mouse click the request and choose INSPECT IN NEW WINDOW
    • A Windows will pop up

Viewing the JSON data
  1. Once the INSPECTOR WINDOW appears, do the following:
    • Click on RESPONSE at the top
    • Click on JSON to view the data
    • Take note of Eat Lunch and Finish Blog Post
      • We entered the data previously at the portal
  2. The goal is to get this data to appear inside of an iOS application.

How to perform a POST (not needed for this post, just extra credit)
  1. This is how you would ADD data.
    • Basically, this is an insert into the database.
  2. Fiddler can also perform a POST, in addition to the GET.
  3. Fiddler supports all the http verbs.
  4. POST is used to insert data into the Mobile Service.

Next Steps
  1. The next post will cover:
    • Creating a new Android Application
    • How to name your application and modules
      • Application Name
      • Project Name
      • Package Name
    • Creating a simple hello world application
    • How to add a listview control
    • Understanding and adding import statements
    • Adding java code to populate the listview control with strings
    • Download the httpclient library from the Apache Foundation
    • Adding the httpclient library to our Android project
    • Adding code to call into Azure Mobile Services
    • Adding permissions to allow our Android app to call into Azure Mobile Services
    • Adding all the java code needed to call into Azure Mobile Services

I appreciate that you took the time to read this post. I look forward to your comments.

The Cloud Zone is brought to you in partnership with Iron.io. Learn how to build and test their Go programs inside Docker containers.


Published at DZone with permission of Bruno Terkaly , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}