1. Problem
You would like to expose an orchestration process as a service to be called from an outside application.
2. Solution
Using BizTalk, an orchestration
can be exposed as a service via the BizTalk WCF Service Publishing
Wizard. Using this tool, the effort to expose an orchestration as a
service is considerably simplified. To expose an orchestration as a
service, take the following steps:
Open the BizTalk WCF Services Publishing Wizard by selecting Start→Programs→BizTalk 2010 =>
BizTalk WCF Services Publishing Wizard.
On the Welcome page, click the Next button.
On the WCF Service Type page, click the Service Endpoint radio button.
Set the Adapter name to WCF-BasicHttp (see Figure 1).
On
the next page, you will have the option of publishing a schema or an
orchestration as a WCF service. Select the orchestration option.
On the BizTalk Assembly page, browse to the DLL that contains the orchestration you are publishing.
On the Orchestration and Ports screen, ensure that the ports you want to expose are selected.
On the WCF Service Properties page, set the namespace to a descriptive value.
On the WCF Service Location, browse to the web directory where this will be published (see Figure 2).
3. How It Works
Exposing orchestrations
as services allows you to reuse orchestration processes by creating
BizTalk configurations to support the passing of a service call to a
BizTalk orchestration. This way, you can take advantage of core BizTalk
capabilities such as error handling, document tracking, and integration
into downstream BizTalk via the publish/subscribe architecture. In
addition, you can extend outside your BizTalk environment, to enable a
service-oriented approach, composite application paradigms, and so on.
The WCF Services
Publishing Wizard interrogates the BizTalk orchestration and receive
ports and creates a service application to support the calling of the
target BizTalk orchestration. This is achieved by creating a service
(SVC) that calls a C# .NET code behind that implements the mechanism of
publishing the message instance to the BizTalk MessageBox.
Just as BizTalk orchestrations
can be exposed as services, so too can XSD schemas. XSD schema services
are also generated using the WCF Services Publishing Wizard, where one
or more XSD schemas are selected and corresponding services are
generated. The service handles sending the message directly to the
BizTalk MessageBox, offering a way to implement publish/subscribe
without the need to create a BizTalk orchestration.