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.
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, and import them to another BizTalk Server Group. You can
choose to export either 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 wish to export the binding file and that you
only wish to export the bindings for the currently selected application.
Open the exported file in a text editor. You should see an XML document
similar to the partial binding file shown in Listing 1.
Listing 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.0.1.0" BindingStatus="FullyBound" BoundEndpoints="2" TotalEndpoints="2"> <Timestamp>2005-07-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 2005 command prompt:
xsd.exe "C:\Program Files\Microsoft BizTalk Server 2006\
Microsoft.BizTalk.Deployment.dll" /type:BindingInfo
The XML schema will be generated in the directory where the command was run.
Processing Scripts
Processing scripts are scripts or executables that are run when installing, importing, or removing a BizTalk application. Table 1 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 1 . Table 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.
Listing 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 2 for the complete list of the environment variables accessible through processing scripts and their description. Table 3
displays the values for the environment variables set by the BizTalk
Server Installer at different stages of the installation or
uninstallation process.
Table 2 . Table 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 3. Table Environment Variable Values at Different Deployment States
Environment Variables |
---|
| BTAD_ChangeRequest | BTAD_Install | BTAD_Host |
---|
Deployment State | Action Values | Mode Values | Class Values |
---|
Import without overwrite flag | Create | Import | ConfigurationDb |
Import with overwrite flag | Update | Import | ConfigurationDb |
Install | Update | Install | BizTalkHostInstance |
Uninstall | Delete | Uninstall | BizTalkHostInstance |
Import rollback | Delete | Import | ConfigurationDb |
Install rollback | Delete | Install | BizTalkHostInstance |