Exposing On-Premise REST Service using Azure Appfabric Service Bus

 
This post is extension to BRE Data Services how to expose the On-Premise REST based service thru Azure appfabric service bus to your partners outside your enterprise securely. We at Tellago have created numerous REST based service for monitoring and managing for BizTalk Server, BRE and RFID Data services etc. Want if your enterprise wants to leverage the service to be accessible outside your enterprise in secured manner by external parties or mobile apps.  So by using Appfabric Service Bus you’re not only creating external accessible endpoint for your service but also any other client within the same network can directly access the service without going thru the cloud as shown below.
 
Windows Azure Service Bus (Source: Microsoft.com)
   If you using BizTalk Server, download the BRE Data Services. Configure as in the installation docs for BRE data service. So now you have your REST based data service ready now, which you want to expose the service to be accessible from outside your enterprise. 
REST Service - Local Host:
So I hope at this point your already have installed the Windows Azure Appfabric SDK on your machine and also created Windows Azure AppFabric service namespace, and obtained a shared secret key. Combination of service namespace and shared secret provides way to authenticate the application accessing the service thru the Service Bus.
Go to the Web.config under the “Tellago.BRE.REST.ServiceHost” project and replace everything within the <system.serviceModel> as shown below and change the place holderYOURNAMESPACEwith your Azure Appfabric namespace and also change the ownerand [YOURKEY] with your issuer Name and issuerSecret. You should be all set to test the service now. I am setting my client authentication type to none as shown in “relayClientAuthenticationType="None"”. Also I am using SharedSecret credentials to bind the service to the cloud (Azure Appfabric service bus). So we basically uses two type of security one to bind the service and service bus and another between service and client. In our case we set the second one to None.
 
Web.config
<?xmlversion="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
    <bindings>
      <!-- Application Binding -->
      <webHttpRelayBinding>
        <bindingname="default">
          <securityrelayClientAuthenticationType="None" />
        </binding>
      </webHttpRelayBinding>
    </bindings>
    <services>
      <!-- Application Service -->
      <servicename="Tellago.BRE.REST.Services.BREManagementService"
             behaviorConfiguration="default">
        <endpointname="RelayEndpoint"
                  contract="System.Data.Services.IRequestHandler"
                  binding="webHttpRelayBinding"
                  bindingConfiguration="default"
                  behaviorConfiguration="sharedSecretClientCredentials"
                  address="https://YOURNAMESPACE.servicebus.windows.net/BREDataServices/BREMananagementService.svc" />
      </service>
    </services>
 
    <behaviors>
      <endpointBehaviors>
        <behaviorname="sharedSecretClientCredentials">
          <transportClientEndpointBehaviorcredentialType="SharedSecret">
            <clientCredentials>
              <sharedSecretissuerName="owner"issuerSecret="[YOURKEY]" />
            </clientCredentials>
          </transportClientEndpointBehavior>
          <serviceRegistrySettingsdiscoveryMode="Public" />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behaviorname="default">
          <serviceDebughttpHelpPageEnabled="false"httpsHelpPageEnabled="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
 
 </system.serviceModel>
</configuration>
 
So we are ready to test our service so your URL would be: https://YOURNAMESPACE.servicebus.windows.net/BREDataServices/BREMananagementService.svc
REST Service thru Service Bus:
It’s cool we are able to access the service outside the enterprise with just changing few lines in the config without going thru any hassle of network team just kidding :). 
Check the following link for Secure Appfabric Service Bus Connection: http://msdn.microsoft.com/en-us/library/dd582773.aspx
Hope you find this helpful and take advantage of this as first step towards the cloud based approach.
 

Print | posted on Thursday, April 14, 2011 11:03 AM

Feedback

No comments posted yet.

Your comment:





 

Copyright © Suresh Girirajan

Design by Bartosz Brzezinski

Design by Phil Haack Based On A Design By Bartosz Brzezinski