Before we go deeper into details of exposing BizTalk Applications to the cloud, let us clarify how cloud related technologies have impacted application and service deployment. We can divide the application and service deployment scenarios into two broad categories:
The BizTalk WCF Service Publishing Wizard essentially exposes the operations in BizTalk Applications as WCF services. AppFabric Connect for Services enhances the wizard to support the relay service provided by Azure AppFabric Service Bus. The wizard enables you to select the operations that you want to expose as services and then creates the following:
Security becomes a paramount concern when organizations expose mission critical data and operations to services outside an organization’s protected environment. To address these concerns, organizations can follow certain security best-practices to ensure that only authenticated clients get access to the service.
This whitepaper assumes some familiarity with Microsoft BizTalk Server, Windows Azure AppFabric Service Bus, Windows Azure AppFabric Access Control Service (ACS), and Windows Communication Foundation (WCF). This whitepaper is intended for the following users:
This whitepaper describes the features provided by AppFabric Connect for Services for the BizTalk WCF Service Publishing Wizard that allow Contoso to expose this BizTalk application as a external web service via the Service Bus relay service. The whitepaper also provides the procedures partner companies can use when writing a client application to invoke the service exposed by Contoso.
Make sure you have the following components installed or configured before you proceed further:
Important: If you choose to install Windows Server AppFabric, you must also install hotfix 980423 (http://go.microsoft.com/fwlink/?LinkId=204211). This fixes some issues with Windows Server AppFabric.
In this section, we will provide step-by-step instructions on how to expose the orchestration as a service on the cloud using the BizTalk WCF Service Publishing wizard. These steps assume the credit check application is already built and deployed internally behind Contoso's firewall. For ease of understanding, this section is divided into the following tasks:
This section walks through each screen of the BizTalk WCF Service Publishing wizard
In this BizTalk Credit Check example application, there are no receive ports or receive locations configured for the application except for the receive port and receive location created by the BizTalk WCF Service Publishing wizard. So we will bind the orchestration to the new receive port and enable the receive location. For more in-depth information regarding configuring WCF Services generated by the wizard see, http://msdn.microsoft.com/en-us/library/bb259973(BTS.70).aspx.
The application pool hosting the WCF service must be configured to use .Net Framework version 4.0 and the Integrated managed pipeline mode. The following steps show how to configure the application pool.
The Auto-Start feature is only available for IIS version 7.5 and later versions. IIS 7.5 is available only for Microsoft Windows 7 and Microsoft Windows Server 2008 R2. Since IIS 7.5 is not supported on Microsoft Windows Server 2008 or Microsoft Windows Vista, auto-start is also not supported on these platforms. You can bring up the service using the on-premise endpoints and this will establish the Service Bus endpoints as well for external client access.
Windows Server AppFabric is a management console that eases configuring auto-start and many other cumbersome management tasks. Thus, we recommend installing Windows Server AppFabric on Windows Server 2008 R2 and Windows 7 platforms. Even on Windows Server 2008 and Windows Vista, installing Windows Server AppFabric is recommended because of its rich manageability features. For more information on configuring Auto-Start see, http://msdn.microsoft.com/en-us/library/ee677285.aspx. The procedures below show how to enable Auto-Start with Windows Server AppFabric installed.
While configuring the service, we had set a property that would make all the endpoints publicly discoverable (see Step 9, "Run the BizTalk WCF Service Publishing Wizard"). To verify if the endpoints are published, view the publicly discoverable endpoints listed in the ATOM feed page for the specified service namespace. The URL for the Service Bus ATOM feed page has the following format:
http://<service namespace>.servicebus.windows.net
In this procedure, the service namespace we used was Contoso. Therefore, the URL will be:
http://Contoso.servicebus.windows.net
Enter this URL in a Web browser and press Enter. It should list all the endpoints available under the specified namespace. If the service you created is registered successfully with Service Bus, you will see it listed as a Public service. In this example the contosocreditcheck service is listed. Clicking contosocreditcheck navigates to list the endpoints created for the service. In this example the following two endpoints are listed for the contosocreditcheck service which verifies the endpoints were published:
In this section, we will create a console application as a client to test the credit check operation through the WCF service. The client will test both the on-premise endpoint and the Service Bus endpoint. The client will first generate a proxy to the WCF service using the Service Bus endpoint. Next, the client will issue a credit request for the amount of $999 to the on-premise endpoint to test the WCF service locally without involving Windows Azure AppFabric Service Bus. Since this request is not greater than $1000, the request should be approved by returning an ApprovalStatus value of True for the CreditCheckResult. The client will then proceed to test the WCF service as an external client through the Service Bus endpoint. A credit request for the amount value of $1001 will be issued against the Service Bus endpoint. This request should be denied with an ApprovalStatus value of False since it is greater than $1000.
<
behaviors
>
endpointBehaviors
behavior
name
=
"sharedSecretClientCredentials"
transportClientEndpointBehavior
credentialType
"SharedSecret"
clientCredentials
sharedSecret
issuerName
"owner"
issuerSecret
"A Valid Contoso Service Bus Access key"
/>
</
client
endpoint
address
"sb://Contoso.servicebus.windows.net/ContosoCreditCheck/WcfService_ContosoCreditCheck.svc"
binding
"netTcpRelayBinding"
bindingConfiguration
"RelayEndpoint"
contract
"ContosoCreditCheck.WcfService_ContosoCreditCheck"
behaviorConfiguration
"http://LocalContosoWebServer/ContosoCreditCheck/WcfService_ContosoCreditCheck.svc"
"wsHttpBinding"
"WSHttpBinding_ITwoWayAsync"
identity
userPrincipalName
value
"someuser@contoso.com"
C#
namespace
ContosoCreditCheckClient
{
class
Program
static
void
Main(
string
[] args)
ContosoCreditService.WcfService_ContosoCreditCheckClient client =
new
ContosoCreditService.WcfService_ContosoCreditCheckClient(
);
ContosoCreditService.CompanyDetails CompanyInfo =
ContosoCreditService.CompanyDetails();
CompanyInfo.CompanyID =
"ContosoClientCompany_ABC123"
;
CompanyInfo.CompanyName =
"Contoso Client ABC123"
CompanyInfo.CreditCheckDate = DateTime.Now.ToLongDateString();
CompanyInfo.Amount = 999;
Console.WriteLine(
"\n\n******************************************************"
"*** Credit Check Request using On-Premise Endpoint ***"
"******************************************************\n"
SimpleTest(ContosoCreditService.WcfService_ContosoCreditCheckClient client, ContosoCreditService.CompanyDetails CompanyInfo);
CompanyInfo.Amount = 1001;
"\n\n*******************************************************"
"*** Credit Check Request using Service Bus Endpoint ***"
"*******************************************************\n"
}
SimpleTest(ContosoCreditService.WcfService_ContosoCreditCheckClient client, ContosoCreditService.CompanyDetails CompanyInfo)
try
"Company ID :\t"
+ CompanyInfo.CompanyID);
"Company Name :\t"
+ CompanyInfo.CompanyName);
"Credit Check Date :\t"
+ CompanyInfo.CreditCheckDate);
"Amount :\t"
+ CompanyInfo.Amount.ToString() +
"\n"
ContosoCreditService.CreditCheckResult result = client.CheckCredit(CompanyInfo);
"***************************"
"*** Credit Check Result ***"
"***************************\n"
+ result.CompanyID);
+ result.CreditCheckDate);
"ApprovalStatus :\t"
+ result.ApprovalStatus.ToString() +
catch
(Exception ex)
"\nException Message : "
+ ex.Message +
"Exception Source : "
+ ex.Source +
if
(ex.InnerException !=
null
)
"\nInner Exception Message : "
+ ex.InnerException.Message +
"Inner Exception Source : "
+ ex.InnerException.Source +
This section lists some known issues with suggested workarounds for the BizTalk WCF Service Publishing Wizard.
If a BizTalk Schema with multiple root nodes is used with the BizTalk WCF Service Publishing Wizard, a WSDL validation error will be reported when generating the client proxy but, it can be safely ignored.
Do not modify the Service Path part of the Service Bus URL in the web.config file generated by the wizard. This will lead to runtime failures.
The BizTalk WCF Service Publishing wizard may fail to work properly if it encounters Unicode characters. For example, the wizard might not give the desired results if the BizTalk artifacts being exposed as services have Unicode characters in their names. You should not use Unicode characters when working with BizTalk WCF Service Publishing wizard.