Freigeben über


Using Fiddler and Advanced Rest Client to test Azure Storage and Azure Mobile Services

  1. This post is about how you can use tooling test your cloud based services

  2. Writing client code to test backend services introduces another level of testing

  3. You end up testing both the client and the server

  4. The secret to testing the service tier is to use 3rd party tools

  5. Chrome's Advanced Rest Client and Fiddler are two examples

SmartDoor Client on Github - Mono-based C# Raspberry PI Client https://github.com/sedouard/SmartDoorDemo
Raspberry Pi - Basic hardware setup, Plugging in camera, Connecting GPIO breakout, Closing up case https://stevenedouard.com/wiring-raspberry-pi-send-photos-cloud/
Running code on your Raspberry Pi to Send Photos the Cloud https://stevenedouard.com/running-code-raspberry-pi-send-photos-cloud/
How to upload Node Packages to Azure Mobile Services https://blogs.msdn.com/b/brunoterkaly/archive/2014/06/18/how-to-upload-node-packages-to-azure-mobile-services.aspx#
How To Provision A Shared Access Signature That Allows Clients To Upload Files To To Azure Storage Using Node.js Inside Of Azure Mobile Services https://blogs.msdn.com/b/brunoterkaly/archive/2014/06/13/how-to-provision-a-shared-access-signatures-that-allows-clients-to-upload-files-to-to-azure-storage-using-node-js-inside-of-azure-mobile-services.aspx#
Running .net Applications On A Raspberry Pi That Communicates With Azure https://blogs.msdn.com/b/brunoterkaly/archive/2014/06/11/mono-how-to-install-on-a-raspberry-pi.aspx#
Using Fiddler and Advanced Rest Client to test Azure Storage and Azure Mobile Services https://blogs.msdn.com/b/brunoterkaly/archive/2014/06/18/using-fiddler-and-advanced-rest-client-to-test-azure-storage-and-azure-mobile-services.aspx

Get Request with Chrome

  1. Used to get a Shared Access Signature

  2. A mobile services account could be used to host a Node.js application that provides shared access signatures to raspberry pi devices

  3. The shared access signature is needed by the raspberry pi, so that it can directly and securely upload photos to Azure storage

  4. We have related posts that shows how Node.js can be used to provide Shared Access Signatures (SAS)

  5. Advanced REST client can be used to test this

Advanced REST Client Interface

  1. See Figure 1

    • The client URL points to your Node.js application running inside of Azure Mobile Services

    • The Mobile Service App key is tied to the Azure Mobile Services that you have provisioned

    • A Get request is how we call into the Node.js Mobile Service API

    • The SAS token is what is returned back

    • The SAS token can be used to upload photos

      • That is tested in the next section

    image001

    Figure 1: Chrome's Advanced Rest Client doing a GET request to get a shared access signature from Azure mobile services

PUT Request with Fiddler

  1. Used to test the shared access signature obtained in the previous step

  2. Will result in a photo getting uploaded using the shared access signature

  3. Figure 2 illustrates:

    • The Client URL encapsulates the SAS Token from the previous step
    • A PUT is need to upload a blob and the SAS Token can be used for that
    • You will need to select a file to upload
    • Then just hit EXECUTE
  4. I just could not get Advanced REST Client to do this part. It sent an incorrect Content-Length regardless of what I tried.

    image002

    Figure 2: Fiddler issuing a PUT request to upload a photo to Azure Storage

The Uploaded File

  1. Visual Studio can show us the uploaded image

  2. You can see the following:

    • The Azure Storage account is called raspberrypistorage
    • The uploaded photo is called 95350.jpg
    • The URL is visible

    image003

    Figure 3: Viewing Azure Storage to verify a photo upload

Conclusion

  1. It is very simple to use proxies and test clients like Advanced Rest Client and Fiddler. Both products are free and can be found easily.

  2. These tools eliminate some potential challenges when testing back end services.

Comments

  • Anonymous
    August 14, 2015
    The comment has been removed