共用方式為


Part 3 of 5: Introduction to Consuming Azure Mobile Services from iOS


This post is using Fiddler to understand clearly how http can be used with Azure Mobile Services.

001

  1. This section will give you some insight about how the underlying service really works.
  2. You can use this insight to interact with Azure Mobile Services from virtually any client that's capable of http.
  3. Fiddler is an amazingly powerful tool.

Previous Posts

Part 1 of 5: Introduction to Consuming Azure Mobile Services from iOS https://blogs.msdn.com/b/brunoterkaly/archive/2012/09/26/part-1-of-5-introduction-to-consuming-azure-mobile-services-from-ios.aspx
Part 2 of 5: Introduction to Consuming Azure Mobile Services from iOS https://blogs.msdn.com/b/brunoterkaly/archive/2012/09/26/part-2-of-5-introduction-to-consuming-azure-mobile-services-from-ios.aspx
Part 3 of 5: Introduction to Consuming Azure Mobile Services from iOS https://blogs.msdn.com/b/brunoterkaly/archive/2012/09/26/part-3-of-5-introduction-to-consuming-azure-mobile-services-from-ios.aspx
Part 4 of 5: Introduction to Consuming Azure Mobile Services from iOS https://blogs.msdn.com/b/brunoterkaly/archive/2012/09/26/part-4-of-5-introduction-to-consuming-azure-mobile-services-from-ios.aspx
Part 5 of 5: Introduction to Consuming Azure Mobile Services from iOS https://blogs.msdn.com/b/brunoterkaly/archive/2012/09/26/part-5-of-5-introduction-to-consuming-azure-mobile-services-from-ios.aspx
Source Code MobileServicesClient
Download a Free Trial https://www.microsoft.com/click/services/Redirect2.ashx?CR_CC=200114759

Using Fiddler

002

  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

Starting Fiddler

003

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

Properly configuring Fiddler

004

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

Issuing a GET request from Fiddler

005

  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

006

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

Viewing the JSON data

007

  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 (Part 2)
  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)

008

  1. Fiddler can also perform a POST, in addition to the GET.
  2. Fiddler supports all the http verbs.
  3. POST is used to insert data into the Mobile Service.
  4. The RequestBody above adds a new row to the TodoItem table.
    1. The row has a TEXT column with the value "Another value to add through http"

You will need a trial account for Windows Azure for these posts to make sense

003_thumb[6][4]

  1. Please sign up for it here:

Next Post, Part 4

In the next post we will start to build our iOS application.