10.1. BizTalk Applications
The BizTalk application becomes the primary scope when
dealing with deployment. Remember, the purpose of a BizTalk application
is to group BizTalk artifacts. Figure 1 depicts a BizTalk application along with the artifacts associated with it.
You can perform the following actions on a BizTalk application:
Enumerate, add, and remove BizTalk artifacts from a BizTalk application. Table 1 shows BizTalk resource artifacts that can be associated with a BizTalk application.
Export
or import all the BizTalk artifacts related to a single business
solution encompassed in a BizTalk application to an MSI file.
Start or stop all the BizTalk artifacts that can be enlisted, started, unenlisted, and stopped within a BizTalk application.
Create or remove dependencies between BizTalk applications by adding or removing references from one application to another.
Table 1. BizTalk Application Resource Artifacts
Artifact | Fully Qualified Resource Type | Description |
---|
.NET assembly | System.BizTalk:Assembly | All .NET assemblies that are used within the BizTalk application. |
BAM definition | System.BizTalk:Bam | All BAM definition files used within the BizTalk application. |
BizTalk assembly | System.BizTalk:BizTalkAssembly | Assembly that contains BizTalk schemas, maps, orchestrations, or pipelines. |
BizTalk binding file | System.BizTalk:BizTalkBinding | XML
files that contain a snapshot of the binding as seen at that instant.
It does not contain details about the completeness of the binding with
respect to the orchestration. |
Security certificate | System.BizTalk:Certificate | BizTalk artifact used to verify the identities and to establish secure communications. Certificates are associated to ports. |
COM component | System.BizTalk:Com | COM components that are used by the BizTalk application. |
Ad hoc file | System.BizTalk:File | Any file that is used by the BizTalk application or that provides information about the BizTalk application. |
Post-processing script | System.BizTalk:PostProcessingScript | Scripts that are executed after a BizTalk application has been installed on a host instance. |
Pre-processing script | System.BizTalk:PreProcessingScript | Scripts that are executed before a BizTalk application has been installed on a host instance. |
Policy or rule | System.BizTalk:Rules | XML files that contain all the different policies and rules contained in the BizTalk rule engine. |
Virtual directory | System.BizTalk:WebDirectory | Any IIS virtual directories that must deploy on the target machine to allow the BizTalk application to function properly. |
BizTalk 2009 requires all
BizTalk artifacts (outside of policies and dependent assemblies) to
belong to a BizTalk application. When configuring a BizTalk Server
Group, a default BizTalk application named BizTalk Application 1 is
created. BizTalk artifacts are deployed to this default BizTalk
application in the following situations:
When upgrading a
BizTalk Server 2004 to BizTalk Server 2009. All the BizTalk 2004
artifacts will be found under the default application.
When deploying BizTalk artifacts using the deprecated BTSDeploy command-line tool.
When
deploying BizTalk assemblies using Visual Studio 2008 without
specifying an application name in the deployment configuration
properties.
When creating ports using the deprecated BizTalk Explorer in Visual Studio.
When adding BizTalk artifacts using the BTSTask command-line application without specifying a BizTalk application name.
When importing an MSI file using the BTSTask command-line application without specifying a BizTalk application name.
2. Important Deployment Artifacts
In this section, you will learn
about binding files and processing scripts. These two artifacts play a
vital role in deploying and managing BizTalk applications. After reading
this section, you may still wonder when these artifacts come into play
upon deploying applications. We will cover this in more detail when we
discuss deployment scenarios. For now, the most important thing is for
you to understand what binding files and processing scripts are.
2.1. Binding Files
Binding files are XML files
describing the different BizTalk artifacts stored in the BizTalk
Management Database and the relationship between these artifacts.
Binding files are useful because they provide a way for an administrator
to export the settings from a BizTalk Server Group, modify them if
necessary for the next environment, and import them to another BizTalk
Server Group. You can choose to export all the information related to a
BizTalk Server Group, or a BizTalk application, or a specific BizTalk
assembly.
The easiest way to
understand what binding files are and what they look like is to export
one from an existing BizTalk application and to look at its content. One
of the ways to export a binding file is to open the BizTalk Server
Administration Console, right-click a BizTalk application, and select
the Export =>
Bindings context menu item. When the Export Bindings window appears,
simply select where you want to export the binding file and that you
want to export the bindings for the currently selected application only.
Open the exported file in a text editor. You should see an XML document
similar to the partial binding file shown in Listing 1.
Example 1. Partial Binding File
<?xml version="1.0" encoding="utf-8"?>
<BindingInfo
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Assembly="Microsoft.BizTalk.Deployment, Version=3.0.1.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"
Version="3.5.1.0"
BindingStatus="FullyBound"
BoundEndpoints="2"
TotalEndpoints="2">
<Timestamp>2009-04-15T17:44:04.9787774-07:00</Timestamp>
<ModuleRefCollection>
...
</ModuleRefCollection>
<SendPortCollection>
...
</SendPortCollection>
<DistributionListCollection>
...
</DistributionListCollection>
<ReceivePortCollection>
...
</ReceivePortCollection>
<PartyCollection>
...
</PartyCollection>
</BindingInfo>
|
There are five important XML elements under the BindingInfo document element:
ModuleRefCollection:
Declares all the BizTalk assemblies and orchestrations used within the
application. It also specifies which physical ports are used for each
orchestration.
SendPortCollection: Contains all the information necessary to create or update all the send port groups.
DistributionListCollection: Contains all the information necessary to create or update all the send port groups.
ReceivePortCollection: Contains all the information necessary to create or update all the receive ports and receive locations.
PartyCollection: Contains all the information necessary to create or update all the parties.
Please refer to the
product documentation for the full list of attributes and elements
available in a binding file. If you need to validate binding files, you
can generate the XML schema for binding files by running the following
command in the Visual Studio 2008 command prompt:
xsd.exe "C:\Program Files\Microsoft BizTalk Server 2009\
Microsoft.BizTalk.Deployment.dll" /type:BindingInfo
The XML schema will be
generated in the directory where the command was run, and then the
validation can be performed (including through the BizTalk Editor).
2. Processing Scripts
Processing scripts are scripts or executables that are run when installing, importing, or removing a BizTalk application. Table 2 displays the different types of files that can be used as processing scripts. Pre-processing scripts run at the beginning of an import or installation process. Post-processing scripts run at the end of an import or installation process.
Table 2. Valid Processing Script Files
Scripts or Executables | Extension |
---|
MS-DOS application | .com |
Application | .exe |
MS-DOS batch file | .bat |
Windows NT command script | .cmd |
VBScript script file | .vbs, .vbe |
JScript script file | .js, .jse |
Windows Script Host setting and Script file | .wsh, .wsf |
Processing scripts are useful
to perform simple or complex operations to reduce the number of manual
operations that must occur when installing or removing a BizTalk
application.
Here are a few examples showing what you can do with processing scripts:
Create a directory structure.
Create a database.
Register COM components.
GAC .NET components.
Start or stop BizTalk applications.
Enlist, start, stop, or unenlist ports and orchestrations.
Listing 2
shows the content of a pre-processing script used to create and remove a
directory structure when installing and removing a BizTalk application.
Example 2. Directories Preprocessing Script
REM Creates and Removes Directories to receive or
REM send files
@setlocal
REM ### For verifying BTAD_* environment variables when script is called.
set LogFile=C:\PROBIZTALK\Log.txt
echo Script Log %DATE% %TIME% > "%LogFile%"
echo Install Directory: %BTAD_InstallDir% > "%LogFile%"
echo Install Mode: %BTAD_InstallMode% > "%LogFile%"
echo Change request action: % BTAD_ChangeRequestAction% > "%LogFile%"
REM ### Create directories prior to BizTalk assembly deployment
if "%BTAD_InstallMode%"=="Install" AND "%BTAD_ChangeRequestAction%"=="Update" (
REM ### Create the folders which will drop messages
mkdir %BTAD_InstallDir%\TestDocuments\In\
mkdir %BTAD_InstallDir%\TestDocuments\Out\
)
REM ### Remove directories after undeploying at the end of uninstallation process
if "%BTAD_InstallMode%"=="Uninstall" AND "%BTAD_ChangeRequestAction%"=="Delete" (
del %BTAD_InstallDir%\TestDocuments\ /s /q
)
REM ### Return exit code of 0 to indicate a success.
echo Script Executed sucessfully > "%LogFile%"
exit /B 0
@endlocal
|
As you can see, Listing 2
uses several environment variables containing a context for a script
developer. Some variables can be set by a developer, and others are set
by the BizTalk Server Installer. Refer to Table 3 for the complete list of the environment variables accessible through processing scripts and their description. Table 4
displays the values for the environment variables set by the BizTalk
Server Installer at different stages of the installation or
uninstallation process.
Table 3. Processing Script Environment Variables
Environment Variable | Description |
---|
BTAD_ChangeRequestAction | Specifies whether the installer is creating, updating, or removing BizTalk artifacts. The possible values are
Create: Imports or installs artifacts without overwriting previous ones
Update: Imports or installs artifacts overwriting previous ones
Delete: Deletes artifacts |
BTAD_HostClass | Specifies
whether the operation is being applied on the BizTalk Management
Database or on the BizTalk host instance. The possible values are
ConfigurationDb
BizTalkHostInstance |
BTAD_InstallMode | Specifies whether a BizTalk application is being imported, installed, or uninstalled. The possible values are
Import
Install
Uninstall |
BTAD_InstallDir | Specifies the installation directory of a BizTalk application. |
BTAD_ApplicationName | Specifies
the name of a BizTalk application. If the name was not provided when
launching the BizTalk Server Installer, it will contain the default
BizTalk application name. |
BTAD_SilentMode | Specifies options for running the script in silent mode. The most commonly used values are
0: Does not change the user interface (UI) level.
1: Uses the default UI level.
2: Performs a silent installation (the default).
3: Provides simple progress and error handling.
4: Provides authored UI; suppresses wizards. |
BTAD_Server | Specifies the name of a SQL Server instance hosting the BizTalk Management Database for a group. |
BTAD_Database | Specifies the name of the BizTalk Management Database for a group. |
Table 4. Environment Variable Values at Different Deployment States
Deployment State | BTAD_Change RequestAction Values | BTAD_InstallMode Values | BTAD_HostClass Values |
---|
Import without flag | Create | Import | ConfigurationDboverwrite |
Import with flag | Update | Import | ConfigurationDboverwrite |
Install | Update | Install | BizTalkHostInstance |
Uninstall | Delete | Uninstall | BizTalkHostInstance |
Import rollback | Delete | Import | ConfigurationDb |
Install rollback | Delete | Install | BizTalkHostInstance |