Demo Script
Windows Azure Service Bus webHttpRelayBinding
Lab version:
2.0.0
Last updated:
2/8/2016
Contents
OVERVIEW ................................................................................................................................................... 3
Key Messages ........................................................................................................................................... 3
Key Technologies ...................................................................................................................................... 3
Time Estimates ......................................................................................................................................... 3
SETUP AND CONFIGURATION .................................................................................................................. 4
Task 1 – Creating a Service Bus Namespace ......................................................................................... 4
Task 2 – Opening the WebHttpRelayBinding Sample ........................................................................... 4
DEMO FLOW ................................................................................................................................................ 4
OPENING STATEMENT............................................................................................................................... 5
STEP-BY-STEP WALKTHROUGH .............................................................................................................. 6
Looking at the code in Visual Studio ......................................................................................................... 6
Run the code and show the image in a browser ....................................................................................... 7
SUMMARY .................................................................................................................................................... 8
KNOWN ISSUES .......................................................................................................................................... 8
Overview
This demo shows the Service Bus webHttpRelayBinding. This allows HTTP requests to be sent to a service over the Service Bus.
The code is part of the Windows Azure SDK samples that you can download from http://code.msdn.microsoft.com/windowsazure.
Note: In order to run through this complete demo, you must have network connectivity and a Service Bus namespace.
Key Messages
1. It is very simple for a .NET developer to modify a typical WCF app to use the relay
2. This binding allows clients to connect to a service over HTTP
Key Technologies
This demo uses the following technologies:
1. .NET Framework 3.5 SP1
2. Visual Studio 2010
3. Windows Azure Libraries for .NET
4. Windows Azure Service Bus (i.e. internet connectivity is required)
Time Estimates

Estimated time for setting up and configuring the demo: 5 min

Estimated time to complete the demo: 5 min
Setup and Configuration
This demo does not have any advanced configuration requirements. Make sure you have checked all the dependencies for this demo and have a
Windows Azure account. For more information on how to purchase an account, visit the Windows Azure Portal at https://windows.azure.com/.
Task 1 – Creating a Service Bus Namespace
1. Navigate to the Windows Azure portal. You will be prompted for your Windows Live ID credentials if you are not already signed in.
2. Click Service Bus, Access Control & Caching link in the left pane, and then select Service Bus item under Services element.
3. Create a Service Namespace.
Task 2 – Opening the WebHttpRelayBinding Sample
1. Download the Relayed Messaging Bindings: WebHttp sample from http://code.msdn.microsoft.com/Relayed-Messaging-Bindingsa6477ba0.
2. Open Visual Studio running as administrator. Open the WebHttpSample solution located in the zip file downloaded in the previous step.
Demo Flow
The following diagram illustrates the high-level flow for this demo and the steps involved:
Figure 1
Diagram
Opening Statement
This demo shows how a service can return binary data – in this case, an image, over the Service Bus to a client using HTTP.
Step-by-Step Walkthrough
This demo is composed of the following segments:
1. Show the code in Visual Studio
2. Run the code and show the image in a browser
Looking at the code in Visual Studio
Action
Script
1. Open the WebHttpSample in Visual
Studio.

This is the service contract. A
message is returned from an HTTP
GET

The service implementation loads a
jpeg from a file and then streams it
back to the client.
2. Open the (service) ImageContract.cs
3. Open ImageService.cs
Screenshot
4. Open the App.config.

The App.config uses the
webHttpRelayBinding and
SharedSecret to authenticate.

In the main program, the service host
uses an “https://”-based URI.
5. Complete the sharedSecret
placeholders (ISSUER_NAME and
ISSUER_SECRET).
6. Open service Program.cs
Run the code and show the image in a browser
Action
Script
7. Right click Service in the Solution
Explorer and select Debug > Start
new instance

8. Enter the service namespace domain.
Now we’ll run the application.
Screenshot
9. Copies the URI displayed in the
console window and paste it into a
browser.
10. [Picture is displayed]

And here is the image displayed in
the browser with a URL of https://
<domain>.servicebus.windows.net/G
etImage/
Summary
This demo showed how you can have a client and a service connect using HTTP over the Service Bus.
Known Issues
Please note the following known issues with this demo: None
Download

Windows Azure Service Bus webHttpRelayBinding