Orchestrating web services with Biztalk Server



BizTalk Server is the cornerstone product in Microsoft's business process and integration strategy. It is through BizTalk that Microsoft is providing the tools to enable developers to integrate applications, businesses, and EDI, and also orchestrate and coordinate information systems with the business users who drive those systems and their processes. In addition, BizTalk provides a developer experience integrated with Visual Studio, making BizTalk applications easier and more intuitive to develop, and integrating easily with existing Microsoft systems and tools that a business may already use. BizTalk currently has the distinction of being the only server product at Microsoft built primarily on the .NET Framework. The upcoming release of BizTalk Server 2006 extends BizTalk Server 2004 to provide new features for developers building orchestrations and integrating applications and simplifies creating orchestrations that consume or create Web services.
BizTalk Server 2006 has several key enhancements related to Web services. These include the BAM Query Web service, the ability to use Web services outside of orchestrations for messaging scenarios, and support for SOAP arrays. This article explores what you need to do to set up a basic orchestration scenario in BizTalk Server 2006 that consumes a Web service. Then you'll look at how you might process the Web service results and extend the orchestration for other uses.
What You Need
To view the sample code you need Visual Studio 2005 and BizTalk Server 2006 Beta 1 or the BizTalk Server 2006 November CTP. For more information, see the BizTalk Server 2006 beta installation guide available from Microsoft Downloads.Setting Up a Web ServiceTo get started, you'll need to set up a .NET Web service that returns an array of results to a BizTalk orchestration. To do that, you'll start with Visual Studio 2005 and create a new ASP.NET Web service project. I'll show you how to add a Web service method to support the orchestration, but that will be sufficient for you to visualize how you could extend the service as needed.In Visual Studio 2005, selecting the default Web service project type from the New Project wizard creates a .cs file with a class derived from System.Web.Services.WebService. Attributes that assign a Web service namespace and establish bindings are included, but you'll need to add your own method (or replace the default HelloWorld method) with your code.A Sample Method to Return a SOAP ArrayCreating a method to return a SOAP array is pretty straightforward. You can use the sample code below, which creates an array of integers, populates the array in a for loop, and returns the array. using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo =
WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
{
public Service () {

}

[WebMethod]
public int[] GetArray()
{
int[] a = new int[10];
for (int i = 0; i < 10; i++)
a[i] = i * 5;
return a;
}

}


Testing the Sample Service
After creating the method, you should test and deploy the service for use in the BizTalk application later. When you use HTTP POST to invoke the service from Internet Explorer, you should get the following XML output in your browser:



0
5
10
15
20
25
30
35
40
45



When you have the Web service up and running, the next task is to incorporate it into your BizTalk application

Comments

Popular posts from this blog