Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

Demo Script - netOnewayRelayBinding

VIEWS: 17 PAGES: 12

									Demo Script
NetOnewayRelayBinding
Lab version:    1.0.6
Last updated:   11/1/2011
Prepared by:    Nigel Watling
CONTENTS

OVERVIEW ................................................................................................................................................... 3
 Key Messages ........................................................................................................................................... 3
   Key Technologies ...................................................................................................................................... 3
   Time Estimates ......................................................................................................................................... 4

SETUP AND CONFIGURATION .................................................................................................................. 4

DEMO FLOW ................................................................................................................................................ 5

OPENING STATEMENT............................................................................................................................... 5

STEP-BY-STEP WALKTHROUGH .............................................................................................................. 6
  Looking at the code in Visual Studio ......................................................................................................... 6
   Show the solution in the .NET Services portal .......................................................................................... 8
   Run the service and client ....................................................................................................................... 10

SUMMARY .................................................................................................................................................. 11

KNOWN ISSUES ........................................................................................................................................ 11
Overview
This demo shows the .NET Services NetOnewayRelayBinding. This is the simplest possible way to send messages on the bus. This sample is good
to show as it uses information cards to authenticate to the bus (Echo, Chat use username and password).
The code is part of the .NET Services SDK and is located at:
C:\Program Files (x86)\Microsoft .NET Services SDK (July 2009 CTP)\Samples\ServiceBus\ExploringFeatures\Bindings\NetOneway\Simple\CS35\

The readme for the sample is here:
C:\Program Files (x86)\Microsoft .NET Services SDK (July 2009 CTP)\Samples\ServiceBus\ExploringFeatures\Bindings\NetOneway\Simple\CS35\Readme.htm



         Note: In order to run through this complete demo, you must have network connectivity and a .NET Services solution.



Key Messages
    1. It is very simple for a .NET developer to modify a typical WCF app to use the relay
    2. You use a Live ID to access your solution the .NET Services portal
    3. You can use a username and password, or an infocard, or a certificate to access your .NET Services solution programmatically using the
       built-in identity store .
    4. Users can use a Live ID or WS-Trust 1.3 compliant token to identify themselves to the Access Control service




Key Technologies
This demo uses the following technologies:
    1. .NET Framework 3.5 SP1
    2. Visual Studio 2008 SP1
    3. Microsoft .NET Services SDK (July 2009 CTP)
    4. .NET Services 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
The setup and configuration for this demo involves the following tasks:
       Task 1 – You need a .NET Services solution. Create one at the portal, http://portal.ex.azure.microsoft.com/. You should have username
        and password credentials and an information card associated with your solution

       Task 2 – Install the Microsoft .NET Services SDK (July 2009 CTP) from http://go.microsoft.com/fwlink/?LinkID=129448 if you have not
        already done so.
       Task 3 – Go into the Solution Credential Management part of the portal and associate a self-issued information card with the solution.
       Task 4 – Open Visual Studio running as administrator and open C:\Program Files (x86)\Microsoft .NET Services SDK (July 2009
        CTP)\Samples\ServiceBus\ExploringFeatures\Bindings\NetOneway\Simple\CS35\NetOnewaySimpleSample.sln.
Demo Flow

The following diagram illustrates the high-level flow for this demo and the steps involved:




                                                   Show the solution in the .NET               Show the choice of credentials
   Show the code in Visual Studio
                                                         Services portal                              for a solution




                                                           Run the                                      Run the
                                                  NetOnewaySimpleSample client                NetOnewaySimpleSample service




Opening Statement
This demo shows the simplest use of the .NET Service Bus using one way messaging over the Service Bus. A set of one-way messages will be sent
from the client app to the service via the Service Bus.




Step-by-Step Walkthrough
This demo is composed of the following segments:
    1. Show the code in Visual Studio
    2. Show the solution in the portal
    3. Run the service and client



Looking at the code in Visual Studio

Action                                     Script                                       Screenshot

1. Open the NetOnewaySimpleSample             This is the service contract. There is
   in Visual Studio                            nothing new here, it looks like any
                                               WCF service contract. Note the
2. Open the (service)
                                               Operation Contract with IsOneWay =
   OnewayContract.cs
                                               true.

3. Open OnewayService.cs                      Here is the service implementation –
                                               again nothing new.
4. Open service App.config              In the App.config however, there are
                                         a number of changes to how we
5. Highlight the binding and then
                                         configure our service on the Service
   transportClientEndpointBehavior
                                         Bus.
   credentialType="CardSpace"
                                        You can see we are using a
                                         netOnewayRelayBinding to connect
                                         to the Service Bus and there is new
                                         endpoint behavior,
                                         transportClientEndpointBehavior
                                         which is specifying a credentialType
                                         of CardSpace. As you might guess,
                                         transportClientEndpointBehavior is
                                         where we specify the Service Bus
                                         credentials to use for a particular
                                         endpoint. Here we are saying they
                                         will be in the form of a self-issued
                                         information card.

6. Open service Program.cs              In the main program we are using the
                                         Microsoft.ServiceBus namespace and
                                         a helper function to get the solution
                                         name. Our service URI is special and
                                         begins sb:// to denote that it will be
                                         hosted on the ServiceBus. Otherwise
                                         the code the looks exactly the same
                                         as in any other WCF console app

7. Open client App.config               On the client side the contract is, of
                                         course, the same. The App.config
                                         uses the same binding,
                                         netOnewayRelayBinding.
8. Open client Program.cs                       In the client’s main program we again
                                                 use the Microsoft.ServiceBus
                                                 namespace and prompt the user for
                                                 the solution name. The URI of the
                                                 service is built up in a similar way to
                                                 the service. The code for actually
                                                 accessing the service is boiler plate
                                                 WCF code – there is nothing new
                                                 here. We create a channel factory,
                                                 create and open a channel, and send
                                                 a message. The user will
                                                 automatically be prompted for their
                                                 information card credentials when the
                                                 first message is sent, driven by the
                                                 policy exposed by the Access Control
                                                 service.


Show the solution in the .NET Services portal

Action                                       Script                                        Screenshot

9. Browse to                                    Here is my solution. The solution
   http://portal.ex.azure.microsoft.com/         name has to be globally unique as it
                                                 forms a public URI so choose yours
10. Sign in using your Live ID credentials
                                                 carefully.
11. Click on your solution on the right
    hand side under My Solutions


12. Click the Credentials link for your         Whereas you use a single Live ID to
    solution                                     access the .NET Services portal
                                                 interactively, there are many options
                                                 when accessing one of the .NET
                                                 Services programmatically. .NET
                                                 Services has a user identity store (for
                                                 testing purposes) with which you can
                                                 use 3 different types of credentials –
                                                 username+password, information
                                                 card and X.509 certificate. Here the
                                               access control service is acting as an
                                               issuer of user identities. You can also
                                               use identities from an external identity
                                               provider: either Live ID or WS-Trust
                                               1.3 compliant identities such as from
                                               Microsoft’s Geneva Server, Tivoli or
                                               Sun.




13. Click on Solution Password to expand      I can change the password for my
    it                                         solution here
14. Click on Windows CardSpace                I can associate an information card
    Information Card                           with the solution here
15. Click on X.509 Certificates               And I can specify a certificate to
                                               associate with the solution here.
Run the service and client

Action                                    Script                                     Screenshot

16. Right click Service in the Solution      Now we’ll run the application.
    Explorer and select Debug > Start
    new instance                             We enter the solution name and
                                              choose the self-issued information
17. Enter your solution name in the           card associated with the solution
    console window when prompted
                                             The service is now running and
18. Choose the information card               connected to the Service Bus where
    associated with the solution              a listener is set up.
19. Right click Client in the Solution       Now we launch the client and again
    Explorer and select Debug > Start         enter the solution name and choose
    new instance                              the right information card. Once the
20. Enter your solution name in the           channel is open the client sends 25
    console window when prompted              one way messages to the service via
                                              the Service Bus.
21. Choose the information card
    associated with the solution
Summary
This demo showed how straightforward it is for a WCF client and service to use the Service Bus. We also looked at the different credentials users
can provide to be authenticated and authorized by the Access Control service.




Known Issues
Please note the following known issues with this demo: None.

								
To top