The BizTalk Messaging Configuration object model enables programmers and administrators to manipulate and manage the BizTalk Messaging system in a programmatic fashion. This section discusses the interfaces in the Configuration object model as well as provides example code that demonstrates interface usage.
The sample code in this section is designed for Visual Basic/Visual Basic Script. The Visual Basic language was chosen for the sake of clarity and brevity. If you want to see sample C++ code, refer to the DistributionList sample that ships with BizTalk Server 2002.
The functionality exposed by the BizTalk Messaging Configuration object model closely replicates the functionality available in BizTalk Messaging Manager. This is no accident because BizTalk Messaging Manager is built directly on top of the Configuration object model. We're going to use this to our advantage as we learn the BizTalk Messaging Configuration object model by relating the properties and methods of each object to concepts we've already learned in BizTalk Messaging.
Table 19.1 lists the interfaces and associated objects exposed by the BizTalk Messaging Configuration object model.
Interface | Implemented By |
---|---|
IBizTalkBase | BizTalkChannel, BizTalkDocument, BizTalkEnvelope, BizTalkOrgnization, BizTalkPort, BizTalkPortGroup |
IBizTalkCertificateInfo | BizTalkCertificateInfo |
IBizTalkChannel | BizTalkChannel |
IBizTalkConfig | BizTalkConfig |
IBizTalkConfigData | BizTalkConfigData |
IBizTalkDocument | BizTalkDocument |
IBizTalkEndPoint | BizTalkEndPoint |
IBizTalkEnvelope | BizTalkEnvelope |
IBizTalkLoggingInfo | BizTalkLoggingInfo |
IBizTalkOrganization | BizTalkOrganization |
IBizTalkPort | BizTalkPort |
IBizTalkPortGroup | BizTalkPortGroup |
IBizTalkServiceWindowInfo | BizTalkServiceWindowInfo |
IBizTalkTransportInfo | BizTalkTransportInfo |
IDictionary | Dictionary |
ISimpleList | SimpleList |
Note
The BizTalk Messaging Configuration interfaces and objects are implemented in BizTalkObjectModel.dll.
Programmatic access to the BizTalk Messaging system begins with the IBizTalkConfig interface. Through its methods, IBizTalkConfig acts as an object factory for the main BizTalk Messaging Configuration objects. The IBizTalkConfig properties serve as a central source for information about existing BizTalk Messaging objects. Table 19.2 lists the properties and methods exposed by the IBizTalkConfig interface.
Name | Type | Description |
---|---|---|
Certificates | Property | ADO recordset containing the list of certificates registered with BizTalk Server |
Channels | Property | ADO recordset containing information about all BizTalk Messaging channels in the database |
CreateChannel | Method | Creates and returns a new BizTalkChannel object |
CreateDocument | Method | Creates and returns a new BizTalkDocument object |
CreateEnvelope | Method | Creates and returns a new BizTalkEnvelope object |
CreateOrganization | Method | Creates and returns a new BizTalkOrganization object |
CreatePort | Method | Creates and returns a new BizTalkPort object |
CreatePortGroup | Method | Creates and returns a new BizTalkPortGroup object |
Documents | Property | ADO recordset containing information about all BizTalk Messaging document definitions in the database |
Envelopes | Property | ADO recordset containing information about all BizTalk Messaging envelopes in the database |
Organizations | Property | ADO recordset containing information about all BizTalk Messaging organizations in the database |
PortGroups | Property | ADO recordset containing information about all BizTalk Messaging distribution lists in the database |
Ports | Property | ADO recordset containing information about all BizTalk Messaging ports in the database |
The following sections discuss these properties and methods in greater detail.
IBizTalkConfig exposes six methods for creating new BizTalk Messaging Configuration objects. Listing 19.1 shows these methods and their syntax.
Set BT = CreateObject("BizTalk.BizTalkConfig") Set org = BT.CreateOrganization Set doc = BT.CreateDocument Set env = BT.CreateEnvelope Set port = BT.CreatePort Set channel = BT.CreateChannel Set group = BT.CreatePortGroup |
Note
The IBizTalkConfig Create methods (CreateChannel, CreateDocument, and so on) only create instances of Configuration objects. You'll learn how to create BizTalk Messaging objects in the database in the next section.
IBizTalkConfig exposes six properties that return ADO recordsets containing information about the BizTalk Messaging objects currently configured in the database. Listing 19.2 shows these properties and their syntax.
Set BT = CreateObject("BizTalk.BizTalkConfig") Set channel_rs = BT.Channels Set doc_rs = BT.Documents Set env_rs = BT.Envelopes Set org_rs = BT.Organizations Set group_rs = BT.PortGroups Set port_rs = BT.Ports |
Table 19.3 shows the fields returned by the ADO recordset properties.
Field | Description |
---|---|
id | Indicates the internal handle for the object |
name | Indicates the name of the object |
datemodified | Indicates the date and time of the last update |
format | Indicates the envelope format (Envelopes property only) |
defaultflag | Indicates the default organization—0 for false, –1 for true (Organizations property only) |
Certificates are used to authenticate and secure exchanges on nonsecured networks. Microsoft BizTalk Server relies heavily on the security provided by certificates. Public-key encryption is supported for all documents handled by BizTalk Server.
The IBizTalkConfig interface allows you to search the contents of a certificate store using the Certificates property. Table 19.4 shows the ADO recordset fields returned by the Certificates property.
Field | Description |
---|---|
name | Specifies the certificate name |
reference | Specifies a reference to the certificate in the certificate store |
store | Specifies the certificate store |
usage | Specifies the how the certificate can be used |
Listing 19.3 demonstrates usage of the Certificates property.
Set BT = CreateObject("BizTalk.BizTalkConfig") Set rs = BT.Certificates(BIZTALK_STORE_TYPE_BIZTALK, BIZTALK_USAGE_TYPE_ENCRYPTION, "") Do While Not rs.EOF MsgBox "Name: " & rs("name") & vbCRLF & _ "Reference: " & rs("reference") & vbCRLF & _ "Store: " & rs("store") & vbCRLF & _ "Usage: " & rs("usage") rs.MoveNext Loop |
Note that the Certificates property is not a traditional property in that it takes several parameters. Those parameters in order are a BIZTALK_STORE_TYPE enumeration value, a BIZTALK_USAGE_TYPE enumeration value, and a prefix filter string to further refine your search.
Tables 19.5 and 19.6 show the possible values for the BIZTALK_STORE_TYPE and BIZTALK_USAGE_TYPE enumerations.
Name | Description |
---|---|
BIZTALK_STORE_TYPE_MY | Store for certificates authorized only by your organization |
BIZTALK_STORE_TYPE_BIZTALK | Dedicated BizTalk Server store |
Name | Description |
---|---|
BIZTALK_USAGE_TYPE_ENCRYPTION | Certificate is used for encryption. |
BIZTALK_USAGE_TYPE_SIGNATURE | Certificate is used for signature. |
BIZTALK_USAGE_TYPE_BOTH | Certificate is used for encryption and signature. |
The IBizTalkBase interface, as its name suggests, exposes common properties and methods of the six primary BizTalk Messaging Configuration objects:
BizTalkChannel
BizTalkDocument
BizTalkEnvelope
BizTalkOrganization
BizTalkPort
BizTalkPortGroup
Table 19.7 lists the properties and methods of the IBizTalkBase interface.
Name | Type | Description |
---|---|---|
Clear | Method | Clears the object in memory |
Create | Method | Creates a new BizTalk Messaging object in the database |
DateModified | Property | Date and time the object was created or saved |
Handle | Property | BizTalk Messaging object handle |
Load | Method | Loads an object from the database by its handle |
LoadByName | Method | Loads an object from the database by its name |
Name | Property | Name of the object |
Remove | Method | Removes the object from the database |
Save | Method | Saves the object to the database |
Figure 19.3 shows the hierarchical relationship between IBizTalkBase and the six primary Configuration interfaces.
BizTalk Messaging objects are created in the database by calling the Create method. Before calling Create, you must name the object:
Org.Name = "BizTalk Unleashed Organization" Org.Create
Note
Some Configuration objects such as BizTalkPort and BizTalkChannel have additional rerequisites before calling the Create method.
BizTalk Server places two restrictions on object names:
The name must be at least one character and can be no more than 64 characters.
The name, which is not case sensitive, must be unique across the database for the object type.
In addition, BizTalk Server reserved several names for BizTalk Messaging objects. Table 19.8 shows the names reserved by BizTalk Server 2002 and their associated object type.
Reserved Name | Object Type |
---|---|
Reliable Message Acknowledgement Port | Port |
Reliable Message Acknowledgement Channel | Channel |
BizTalk Canonical Receipt | Document definition |
Reliable Messaging Acknowledgement | Document definition |
Reliable Messaging Acknowledgement SMTP from Address | Organization identifier |
Home Organization | Organization |
When new objects are created in the database, BizTalk Server generates and assigns a unique internal handle value to the object. This value is static for the life of the object on this server. After calling Create, the Handle and DateModified properties are updated to
reflect the new object information.
Note
The DateModified property returns a string with the coordinate universal time (UTC) in the format yyyy-mm-dd hh:mm:ss.
Caution
The BizTalk Server 2002 documentation warns that when creating or saving an object that refers to an XML document specification outside your local domain, you may receive an error. If an error occurs, you will need to download and configure the WinHTTP proxy utility from the Microsoft MSDN Web site.
To change any of the settings for an existing BizTalk Messaging object, you must first load the object into memory. IBizTalkBase provides two methods for doing just that, Load and LoadByName. The following sample code demonstrates how to use these methods:
Org.Load hOrg ' where hOrg is the handle to an organization Org.LoadByName "BizTalk Unleashed Organization"
After loading the object, you can make the necessary changes through the properties and methods of the Configuration object. Call the Save method to store your changes back to the database. The following code sample demonstrates an update to an organization in the database:
Org.LoadByName "BizTalk Unleashed Organization" Org.Name = "New BizTalk Unleashed Organization" Org.CreateAlias "My Alias", False, "Qualifier", "Value" Org.Save
After you call Save, the DateModified property is updated to reflect the new date and time.
Caution
Changing the name of an existing BizTalk Messaging object could adversely affect scripts and schedules that refer to the object by name.
To remove an object from the BizTalk Messaging database, first load the object into memory and then call Remove to delete the object from the database. For example:
Org.LoadByName "New BizTalk Unleashed Organization" Org.Remove
Caution
The Remove method will fail when called for a BizTalk Messaging object that is referred to by another BizTalk Messaging object or a running XLANG schedule. This is known as referential integrity. BizTalk Server enforces referential integrity in the BizTalk Messaging database.
Listing 19.4 shows a simple example illustrating the use of the IBizTalkBase properties and methods. Because a BizTalkBase object cannot be instantiated directly, a surrogate BizTalkOrganization object is used.
Tip
You can see the effects of this code in real-time through BizTalk Messaging Manager. Make sure that you refresh the search after each step.
' Step 1 - Create an organization configuration object Set BT = CreateObject("BizTalk.BizTalkConfig") Set org = BT.CreateOrganization() ' Step 2 - Name the organization and create it in the database org.Name = "BizTalk Unleashed Organization" hOrg = org.Create() MsgBox "New object created, Handle = " & org.Handle & ", DateModified = " & org .DateModified & "." ' Step 3 - Load our Organization by handle org.Clear org.Load hOrg MsgBox org.Name & " loaded." ' Step 4 - Change the organization's name and save it back to the database org.Name = "BizTalk Unleashed Sample Organization" org.Save MsgBox org.Name & " saved." ' Step 5 - Clear the config object and load our organization by name org.Clear org.LoadByName "BizTalk Unleashed Sample Organization" MsgBox org.Name & " loaded." ' Step 6 - Remove our new organization from the database org.Remove MsgBox org.Name & " removed." |
Note
The code (19newListing04.vbs) in Listing 19.4 is also available for download at the Sams Publishing Web site.
The IBizTalkOrganization interface exposes properties and methods that manage BizTalk Messaging organizations. Organizations represent trading partners with which you exchange documents. The Home Organization represents your business and may contain specific applications where inbound documents are routed. Table 19.9 shows the properties and methods of the IBizTalkOrganization interface.
Name | Type | Description |
---|---|---|
Aliases | Property | ADO recordset containing information about all aliases for the organization |
Applications | Property | ADO recordset containing information about all applications in the organization |
Comments | Property | User comments about the organization |
CreateAlias | Method | Creates an alias |
CreateApplication | Method | Creates an application |
GetDefaultAlias | Method | Returns the handle to the default alias |
IsDefault | Property | Flag indicating whether the organization is default/ |
LoadAlias | Method | Loads an alias into memory |
LoadApplication | Method | Loads an application into memory |
RemoveAlias | Method | Removes an alias |
RemoveApplication | Method | Removes an application |
SaveAlias | Method | Saves an alias |
SaveApplication | Method | Saves an application |
In addition to the properties and methods shown in Table 19.9, BizTalkOrganization objects also implement the properties and methods of IBizTalkBase shown in Table 19.7.
Note
BizTalk Messaging Manager refers to the default organization as the Home Organization. The home organization cannot be deleted from the BizTalk Messaging database.
Figure 19.4 shows a UML-style diagram illustrating the relationship between IBizTalkOrganization and IBizTalkBase.
The following sections discuss the properties and methods of the IBizTalkOrganization interface.
Aliases are otherwise known as identifiers in BizTalk Messaging Manager. They specify qualifier-value pairs that uniquely identify an organization and consist of four properties:
A handle that uniquely identifies the alias across the BizTalk Messaging database. Alias handles are assigned by BizTalk Server when the alias is created.
A name unique across the organization object.
An qualifier-value pair unique across the BizTalk Messaging database.
A Boolean flag to indicate whether the alias is default.
Multiple aliases can be specified for a single organization; however, each alias name must be unique for the given organization. Alias qualifier-value pairs must be unique across all organizations in the database.
When new organizations are created, BizTalk Server automatically generates an alias with the name “Organization” and the qualifier-value pair, "OrganizationName"-<name of organization>. When an organization name is changed, BizTalk Server automatically updates the value in this qualifier-value pair to reflect the new organization name. Use the CreateAlias, LoadAlias, SaveAlias, and RemoveAlias methods to manipulate the current list of aliases for an organization. Listing 19.5 shows sample code that uses these methods. The handle value (100034) is made up for illustration purposes.
org.CreateAlias "My Alias Name", False, "Alias Qualifier", "Alias Value" Dim name, def, qual, val org.LoadAlias 100034, name, def, qual, val val = "New Alias Value" org.SaveAlias 100034, name, def, qual, val org.RemoveAlias 100034 |
You cannot remove auto-generated aliases, default aliases, or aliases referred to by BizTalk Messaging channels and/or ports.
Note
After creating, saving, or removing an alias from a BizTalkOrganization object, you must call the Create or Save method to persist the new alias settings in the database.
The Aliases property returns an ADO recordset containing the current list of aliases in the organization. Table 19.10 shows the fields returned for each record.
Field | Description |
---|---|
id | Specifies the alias handle |
name | Specifies the alias name |
defaultflag | Specifies whether the alias is default (0 for false, –1 for true) |
qualifier | Specifies the identifier in the alias identifier-value pair |
value | Specifies the value in the alias identifier-value pair |
Listing 19.6 shows example usage of the Aliases property.
Set BT = CreateObject("BizTalk.BizTalkConfig") Set org = BT.CreateOrganization org.LoadByName "Home Organization" Set rs = org.Aliases Do While Not rs.EOF MsgBox "ID: " & rs("id") & vbCRLF & _ "Name: " & rs("name") & vbCrLf & _ "Default: " & rs("defaultflag") & vbCRLF & _ "Qualifier: " & rs("qualifier") & vbCrLf &_ "Value: " & rs("value") rs.MoveNext Loop |
Applications in the Home Organization identify actual internal applications within your business. They do not, however, enable the flow of documents through BizTalk Messaging to the internal applications. Instead, they serve as placeholders to indicate a document destination. The actual configuration that enables the flow of documents to an application is specified by the transport properties of a messaging port.
BizTalk Messaging Manager only allows applications to be created in the Home Organization. The Configuration object model, however, does not enforce this rule. Therefore, any applications created in nondefault organizations cannot be manipulated in BizTalk Messaging Manager. Although creating applications outside the Home Organization is generally not recommended, it is possible to access and manipulate them through the Configuration object model.
Note
An application name must be unique within its organization.
Use the CreateApplication, LoadApplication, SaveApplication, and RemoveApplication methods to manipulate the current list of applications for an organization. Listing 19.7 shows sample code that uses these methods. Once again the handle value (100034) is made up for illustration purposes.
org.CreateApplication "My Application Name" Dim name org.LoadApplication 100034, name name = "New Application Name" org.SaveApplication 100034, name org.RemoveApplication 100034 |
An application cannot be removed if a BizTalk Messaging port or channel refers to it.
Note
After creating, saving, or removing an application from the Home Organization, you must call the Create or Save method on the associated BizTalkOrganization object to persist the new application settings in the database.
The Applications property returns an ADO recordset containing the current list of applications in the organization. Table 19.11 shows the fields returned for each record.
Field | Description |
---|---|
id | The application handle |
name | The application name |
Listing 19.8 demonstrates the creation of a new partner organization named Joe's Crab Shack.
' Create a new organization Set BT = CreateObject("BizTalk.BizTalkConfig") Set org = BT.CreateOrganization org.Name = "Joe's Crab Shack" org.Create ' Create an alias for the organization org.CreateAlias "Best Crabcakes in Maryland", False, "Awards", "Best Crabcakes" org.Save ' Add a new application to the home organization org.Clear org.LoadByName "Home Organization" org.CreateApplication "Restaurant Reviews" org.CreateApplication "My Application" org.Save |
The IBizTalkDocument interface provides properties and methods for managing BizTalk Messaging document definitions. Document definitions represent specific types of documents handled by BizTalk Server. They consist of a BizTalk Server-specific XML document specification schema, which describes the content and format of the document. Table 19.12 shows the properties and methods of the IBizTalkDocument interface.
Name | Type | Description |
---|---|---|
Content | Property | Content of the document definition specified by Reference |
LoadByPropertySet | Method | Loads the document definition based on the specified PropertySet Dictionary object |
NameSpace | Property | String that resolves naming conflicts in the document |
PropertySet | Property | Dictionary object containing the selection criteria for extracting information from an EDI document |
Reference | Property | WebDAV URL specifying the document specification file |
TrackFields | Property | Dictionary object containing the custom fields that Tracking uses to track documents based on this specification |
Type | Property | Document specification type |
Version | Property | Version of the document standard |
In addition to the properties and methods shown in Table 19.12, BizTalkDocument objects also implement the properties and methods of IBizTalkBase, shown in Table 19.7.
Figure 19.5 shows a UML-style diagram illustrating the relationships between IBizTalkDocument and various Configuration interfaces.
The document specification for a BizTalkDocument object is set by specifying the full WedDAV URL for the document specification file in the Reference property. For example:
doc.Reference = "http://machine/BizTalkServerRepository/DocSpecs/Microsoft/CommonPO.xml"
When a document definition is created or saved using the Create or Save methods, the Content, NameSpace, Type, and Version properties are updated to reflect the new document specification. When Reference is empty, these properties are cleared.
Document tracking data designates fields within the document specification that you want to log to the Tracking database. The TrackFields property is used to specify tracking data for a BizTalkDocument object. TrackFields returns a Dictionary object containing the custom fields that Tracking uses to track documents based on this specification. Tracking fields apply only to inbound documents in a channel. Any tracking data specified for an outbound document is ignored by BizTalk Server.
Note
A valid document definition must be specified in the Reference property before setting any tracking data.
Table 19.13 shows the predefined Dictionary fields used by Tracking.
Field Name | Field Type |
---|---|
i_value1 | Integer value |
i_value2 | Integer value |
r_value1 | Real value |
r_value2 | Real value |
d_value1 | Date value |
d_value2 | Date value |
s_value1 | String value |
s_value2 | String value |
x_custom_search | List of additional tracking fields |
The fields in the dictionary must contain valid XPath values that identify the fields to be tracked. Listing 19.9 shows some example XPath expressions. The XPath expressions were derived from the CommonPO.xml document specification that ships with BizTalk Server.
doc.TrackFields.r_value1 = "/CommonPO/SpecialCharge/@Amount" doc.TrackFields.r_value2 = "/CommonPO/Currency/@ExchangeRate" doc.TrackFields.s_value1 = "/CommonPO/TermsOfSale/@PaymentMethod" doc.TrackFields.s_value2 = "/CommonPO/CarrierDetail/@Routing" doc.TrackFields.i_value1 = "/CommonPO/TermsOfSale/@NetDays" doc.TrackFields.i_value2 = "/CommonPO/TermsOfSale/@DiscountDaysDue" doc.TrackFields.d_value1 = "/CommonPO/Item/DateReference/@Date" doc.TrackFields.d_value2 = /CommonPO/POHeader/@CreationDate |
If additional fields are required, the x_custom_search field can be used. x_custom_search returns a SimpleList to which fields can be added or removed using the ISimpleList.Add and ISimpleList.Remove methods. Listing 19.10 shows sample code for the x_custom_search Dictionary field.
doc.TrackFields.x_custom_search.Add "/CommonPO/Total/@LineItemTotal" doc.TrackFields.x_custom_search.Add "/CommonPO/Total/@QuantityTotal" doc.TrackFields.x_custom_search.Add "/CommonPO/Total/@POTotal" doc.TrackFields.x_custom_search.Remove "/CommonPO/POHeader/@Purpose" doc.TrackFields.x_custom_search.Remove /CommonPO/POHeader/@Type |
Selection criteria are a set of unique name-value pairs used to process EDI documents. The PropertySet property is used to specify selection criteria for a BizTalkDocument object. PropertySet returns a Dictionary object with the EDI selection criteria for the document specification. Selection criteria is required for X12 and EDIFACT type document definitions.
Note
A valid document definition must be specified by the Reference property before setting any selection criteria.
Tables 19.14 and 19.15 show the required and optional header elements that must be specified for EDI document specifications.
Field Name | Required | GS Element |
---|---|---|
functional_identifier | Yes | GS01 |
application_sender_code | Yes | GS02 |
application_receiver_code | Yes | GS03 |
standards_version | Yes | GS08 |
Field Name | Required | UNH Element | UNG Element |
---|---|---|---|
functional_identifier | Yes | S009, 0065 | 0038 |
application_sender_code | No | not used | S006, 0040 |
application_receiver_code | No | not used | S007, 0044 |
standards_version_type | Yes | S009, 0052 | S008, 0052 |
standards_version_value | Yes | S009, 0054 | S008, 0054 |
Listing 19.11 shows sample code that creates a new document definition named Restaurant Reviewer based on the CommonPartnerProfile.xml document specification that ships with BizTalk Server. Before running this code on your machine, you need to change machine in the Reference WebDAV URL to the network name of the machine where your BizTalk Server is installed.
' Create a new document specification
Set BT = CreateObject("BizTalk.BizTalkConfig")
Set doc = BT.CreateDocument
doc.Name = "Restaurant Reviewer"
doc.Reference = "http://machine/BizTalkServerRepository/DocSpecs/Microsoft
/CommonPartnerProfile.xml"
doc.Create
' Add tracking fields
doc.TrackFields.s_value1 = "/CommonPartnerProfile/Name/@Text"
doc.TrackFields.s_value2 = "/CommonPartnerProfile/Location/@AgencyCode"
doc.Save
|
Tip
After running this script, you can review the changes in BizTalk Messaging Manager.
The IBizTalkEnvelope interface provides properties and methods for managing BizTalk Messaging envelopes. An envelope encapsulates electronic business data for transport into and out of BizTalk Server. Conceptually, it consists of a header and sometimes a footer and provides BizTalk Server with the necessary information to open inbound interchanges and create outbound documents.
The BizTalk Messaging envelope itself consists of a format type, which in turn may require an envelope specification. Table 19.16 shows the properties of the IBizTalkEnvelope interface.
Name | Type | Description |
---|---|---|
Content | Property | Content of the envelope specification indicated by Reference |
Format | Property | Specifies the envelope format |
NameSpace | Property | String that resolves naming conflicts in the document |
Reference | Property | WebDAV URL specifying the envelope specification file |
Version | Property | Version of the envelope format specification |
In addition to the properties and methods shown in Table 19.16, BizTalkEnvelope objects also implement the properties and methods of IBizTalkBase, shown in Table 19.7.
Figure 19.6 shows a UML-style diagram illustrating the relationships between IBizTalkEnvelope and various Configuration interfaces.
An envelope format is specified through the Format property. Format takes one of the following strings:
x12
edifact
custom xml
flatfile
custom
reliable
Specifying anything other than one of these strings results in a runtime error when Save or Create is called. If this occurs, the previously specified format is not changed. The following code sample shows correct and incorrect format specification strings:
env.Format = "edifact" ' OK env.Format = "EDIFACT" ' OK env.Format = "flatfile" ' OK env.Format = "flat file" ' Error
Notice that the format string is not case sensitive.
Note
Custom formats require that a custom parser and/or serializer be registered with BizTalk Server. Refer to Chapter 18, “Creating Custom Seriliazers, Parsers, and Functoids,” for more information about creating custom parsers andserializers.
The conditionally required envelope specification is specified through the Reference property. Reference takes a string containing the full WebDAV URL for the envelope specification file. X12, EDIFACT, and reliable are well-known formats to BizTalk Server and as such do not need a specification file. The system goes so far as to throw a runtime error when Reference is set for one of these formats. Listing 19.12 shows correct and incorrect usage of the Reference property for an EDI envelope.
' Incorrect: Set BT = CreateObject("BizTalk.BizTalkConfig") Set env = BT.CreateEnvelope env.Name = "BizTalk Unleashed Envelope" env.Format = "x12" env.Reference = "http://machine/BizTalkServerRepository/DocSpecs/Envelope.xml" env.Create ' Runtime error! ' Correct: Set BT = CreateObject("BizTalk.BizTalkConfig") Set env = BT.CreateEnvelope env.Name = "BizTalk Unleashed Envelope" env.Format = "x12" env.Create |
When an envelope is created or saved using the Create or Save methods, the Content, NameSpace, and Version properties are updated to reflect the new envelope specification. If Reference is empty, these properties are cleared to their default values.
Listing 19.13 shows an example that creates an envelope based on the Simple SOAP Envelope document specification that ships with BizTalk Server 2002.
Set BT = CreateObject("BizTalk.BizTalkConfig")
Set env = BT.CreateEnvelope
env.Name = "Simple Soap Envelope"
env.Format = "custom xml"
env.Reference = "http://machine/BizTalkServerRepository/DocSpecs/Microsoft/ Simple SOAP
Envelope.xml"
env.Create
|
The IBizTalkPort interface provides properties and methods for managing BizTalk Messaging ports. A BizTalk Messaging port defines the one-way transfer of a document between organizations and applications. Table 19.17 shows the properties and methods of the IBizTalkPort interface.
Name | Type | Description |
---|---|---|
Channels | Property | ADO recordset containing information about all channels that refer to this port |
Comments | Property | User comments about the port |
ControlNumberValue | Property | Interchange control number |
Delimiters | Property | Dictionary object containing all delimiters used in the document specification |
DestinationEndPoint | Property | BizTalkEndPoint object containing information about the destination |
EncodingType | Property | BIZTALK_ENCODING_TYPE enumeration value that indicates the document encoding type |
EncryptionCertificateInfo | Property | BizTalkCertificateInfo object containing information about the certificate that encrypts the document |
EncryptionType | Property | BIZTALK_ENCRYPTION_TYPE enumeration value that indicates the document encryption type |
Envelope | Property | Handle to the associated envelope |
PrimaryTransport | Property | BizTalkTransportInfo object containing information about the primary transport |
SecondaryTransport | Property | BizTalkTransportInfo object containing information about the secondary transport |
ServiceWindowTransport | Property | BizTalkServiceWindowInfo object containing information about the service window |
SignatureType | Property | BIZTALK_SIGNATURE_TYPE enumeration value that indicates the type of digital signing and verification |
In addition to the properties and methods shown in Table 19.17, BizTalkPort objects also implement the properties and methods of IBizTalkBase shown in Table 19.7.
Figure 19.7 shows a UML-style diagram illustrating the relationships between IBizTalkPort and various Configuration interfaces.
Messaging port destinations specify where the messaging port delivers documents. Destinations can be organizations, XLANG schedules, or applications in the Home Organization. A messaging port destination is specified through the DestinationEndPoint property of the IBizTalkPort interface. DestinationEndPoint returns an instance of an object that implements the IBizTalkEndPoint interface. Table 19.18 shows the properties of the IBizTalkEndPoint interface.
Name | Type | Description |
---|---|---|
Alias | Property | Handle to the organization alias for the destination organization |
Application | Property | Handle to the associated application in the destination organization |
Openness | Property | BIZTALK_OPENNESS_TYPE_EX enumeration value that indicates the openness of the destination |
Organization | Property | Handle to the destination organization |
Table 19.19 shows the possible enumeration values for the Openness property of the IBizTalkEndPoint interface.
Name | Description |
---|---|
BIZTALK_OPENNESS_TYPE_EX_NOTOPEN | Not open. |
BIZTALK_OPENNESS_TYPE_EX_SOURCE | Source organization is open. |
BIZTALK_OPENNESS_TYPE_EX_DESTINATION | Destination organization is open. |
BIZTALK_OPENNESS_TYPE_EX_FROMWORKFLOW | Document is received from an XLANG schedule. |
BIZTALK_OPENNESS_TYPE_EX_TOWORKFLOW | Document is sent to an XLANG schedule. |
The Alias and Organization properties can both be used for specifying a destination organization. It is not necessary to specify an alias and an organization, though; one or the other will suffice.
The following “Destination:” sections discuss the various messaging port destination types and the implications of using each type.
For destinations to organizations, the messaging port may specify a specific partner organization or leave the destination open, creating an open messaging port. Open messaging ports expect the destination information to be supplied at runtime through fields in the document or parameters passed during submission.
Before configuring a messaging port to an organization, the organization must be added to the BizTalk Messaging database. Listing 19.14 demonstrates the required settings for the DestinationEndPoint property to configure a messaging port to a specific partner organization.
org.LoadByName "Joe's Crab Shack" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN |
Listing 19.15 demonstrates the required settings for the DestinationEndPoint property to configure an open messaging port.
port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_DESTINATION |
When creating open messaging ports, you must abide by the following constraints:
PrimaryTransport.Type must be set to BIZTALK_OPENNESS_TYPE_OPENDESTINATION.
EncryptionType cannot be set.
The messaging port cannot be included in a distribution group.
Messaging ports to XLANG schedules can be configured to activate a new XLANG schedule or deliver documents to a running XLANG schedule. Listing 19.16 demonstrates the required settings for the DestinationEndPoint property to configure a messaging port to activate an XLANG schedule.
org.LoadByName "Home Organization" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_TOWORKFLOW |
Listing 19.17 demonstrates the required settings for the DestinationEndPoint property to configure a messaging port to a running XLANG schedule.
port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_TOWORKFLOW |
Notice that a destination to a running XLANG schedule does not require that an organization be specified. Information that identifies running XLANG schedules is passed in document fields as parameters during document submission.
Before configuring a messaging port destination to an application, the application must be added to the Home Organization. Listing 19.18 demonstrates the required settings for the DestinationEndPoint property to configure a messaging port to an application.
org.LoadByName "Home Organization" Set rs = org.Applications AppHandle = 0 Do While Not rs.EOF If (rs("name") = "My Application") Then AppHandle = rs("id") Exit Do End If rs.MoveNext Loop port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Application = AppHandle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN |
Messaging port transports specify the transport service that will be used to transport documents as well as the specific address to which documents are sent. Messaging port transports are specified through the PrimaryTransport and SecondaryTransport properties of the IBizTalkPort interface. Both properties return an instance of an object that implements the IBizTalkTransportInfo interface. Table 19.20 shows the properties of the IBizTalkTransportInfo interface.
Name | Type | Description |
---|---|---|
Address | Property | Destination address |
Parameter | Property | Specifies additional information as required by Type and Address |
Type | Property | BIZTALK_TRANSPORT_TYPE enumeration value that indicates the type of transport component to use |
The transport type is specified through the Type property of the IBizTalkTransportInfo interface. Table 19.21 shows the transport type enumeration values.
Name | Description |
---|---|
BIZTALK_TRANSPORT_TYPE_ APPINTEGRATION | Application Integration Component |
BIZTALK_TRANSPORT_TYPE_FILE | File |
BIZTALK_TRANSPORT_TYPE_HTTP | Hypertext Transport (HTTP) |
BIZTALK_TRANSPORT_TYPE_HTTPS | Secure Hypertext Transport (HTTPS) |
BIZTALK_TRANSPORT_TYPE_ LOOPBACK | Specifies that the submitted document is processed and returned as the response document |
BIZTALK_TRANSPORT_TYPE_MSMQ | Microsoft Message Queuing (MSMQ) |
BIZTALK_TRANSPORT_TYPE_NONE | No transport component |
BIZTALK_TRANSPORT_TYPE_ OPENDESTINATION | Open messaging port |
BIZTALK_TRANSPORT_TYPE_ ORCHESTRATIONACTIVATION | Specifies that the document activates a new XLANG schedule instance |
BIZTALK_TRANSPORT_TYPE_SMTP | Simple Mail Transfer (SMTP) |
Transport type is closely tied to—and even constrained by—the destination type of the associated messaging port. For example, open messaging ports must specify BIZTALK_TRANSPORT_TYPE_OPENDESTINATION as their primary transport type.
Messaging ports that activate new XLANG schedules must set their primary transport type to BIZTALK_TRANSPORT_TYPE_ORCHESTRATIONACTIVATION.
The transport address indicates the destination of the document and is specified through the Address property of the IBizTalkEndPoint interface. Table 19.22 shows the transport types that require an associated address as well as the address prefix required by the type.
Transport Types | Prefix (if any) |
---|---|
BIZTALK_TRANSPORT_TYPE_APPINTEGRATION | |
BIZTALK_TRANSPORT_TYPE_FILE | file:// |
BIZTALK_TRANSPORT_TYPE_HTTP | http:// |
BIZTALK_TRANSPORT_TYPE_HTTPS | https:// |
BIZTALK_TRANSPORT_TYPE_MSMQ | |
BIZTALK_TRANSPORT_TYPE_ORCHESTRATIONACTIVATION | |
BIZTALK_TRANSPORT_TYPE_SMTP | mailto: |
Listing 19.19 shows example usage of the Type and Address properties for each available transport type in BizTalk Server.
port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_APPINTEGRATION port.PrimaryTransport.Address = "{11111111-1111-1111-1111-111111111111}" port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_FILE port.PrimaryTransport.Address = "file://C:BizTalk UnleashedTest.xml" port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_HTTP port.PrimaryTransport.Address = "http://www.samspublishing.com" port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_HTTPS port.PrimaryTransport.Address = " https://www.samspublishing.com " ' Does not require Address port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_LOOPBACK port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_MSMQ port.PrimaryTransport.Address = "DIRECT=OS:.private$myqueue" ' Does not require Address port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_NONE ' Does not require Address port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_OPENDESTINATION port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_ORCHESTRATIONACTIVATION port.PrimaryTransport.Address = "C:BizTalk Unleashed est.skx" port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_SMTP port.PrimaryTransport.Address = mailto:[email protected] |
For the most part, there are no surprises in the sample addresses listed here. One exception may be the address for BIZTALK_TRANSPORT_TYPE_APPINTEGRATION. The APPINTEGRATION address specifies the CLSID of a registered COM+ AIC component.
Some transport types require additional information beyond the transport address. Additional data is specified through the Parameter property of the IBizTalkTransportInfo interface. Table 19.23 shows which transport types require more information and what that information is.
Transport | Parameter |
---|---|
SMTP | Return e-mail address of the associated source |
Schedule Activation | BizTalk Orchestration port in the schedule to be activated |
A service window indicates the valid time range as hours in the day for transmitting documents. A service window is specified through the ServiceWindowTransport property of the IBizTalkPort interface. ServiceWindowTransport returns an instance of an object that implements the IBizTalkServiceWindowInfo interface. Table 19.24 shows the properties of the IBizTalkServiceWindowInfo interface.
Name | Type | Description |
---|---|---|
FromTime | Property | Specifies the earliest hour of any day that the interchange can be transmitted |
IsEnabled | Property | Specifies whether the service window is enabled |
ToTime | Property | Specifies the latest hour of any day that the interchange can be transmitted |
When setting a service window, you must specify a valid time range using the FromTime and ToTime properties of BizTalkServiceWindowInfo. Service window times must contain a value between 0 and 23 indicating the hour of the day. BizTalk Server does not provide support for fractional hours or minutes. Listing 19.20 shows sample code that uses the ServiceWindowTransport property.
' 7am to 7pm port.ServiceWindowTransport.FromTime = 7 port.ServiceWindowTransport.ToTime = 19 port.ServiceWindowTransport.IsEnabled = True |
The following sections will build on the samples started in the “Destination” section to include transport information.
Listing 19.21 demonstrates the required destination and transport settings to configure a messaging port to an organization over HTTPS (primary) and HTTP (secondary).
org.LoadByName "Joe's Crab Shack" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_HTTPS port.PrimaryTransport.Address = "https://secure.joescrabs.com" port.SecondaryTransport.Type = BIZTALK_TRANSPORT_TYPE_HTTP port.SecondaryTransport.Address = http://www.joescrabs.com |
Listing 19.22 demonstrates the required destination and transport settings to configure a messaging port to an organization over SMTP.
org.LoadByName "Joe's Crab Shack" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_SMTP port.PrimaryTransport.Address = "mailto:[email protected]" port.PrimaryTransport.Parameter = mailto:[email protected] |
Listing 19.23 demonstrates the required destination and transport settings to configure an open messaging port.
port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_DESTINATION port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_OPENDESTINATION |
Listing 19.24 demonstrates the required destination and transport settings to configure a messaging port to activate a new XLANG schedule.
org.LoadByName "Home Organization" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_TOWORKFLOW port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_ORCHESTRATIONACTIVATION port.PrimaryTransport.Address = "C:BizTalkSchedulesMySchedule.skd" port.PrimaryTransport.Parameter = "start_port" |
Listing 19.25 demonstrates the required destination and transport settings to configure a messaging port to a running XLANG schedule.
port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_TOWORKFLOW port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_OPENDESTINATION |
Listing 19.26 demonstrates the required destination and transport settings to configure a messaging port to an Application Integration Component (AIC).
org.LoadByName "Home Organization" Set rs = org.Applications AppHandle = 0 Do While Not rs.EOF If (rs("name") = "My Application") Then AppHandle = rs("id") Exit Do End If rs.MoveNext Loop port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Application = AppHandle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_APPINTEGRATION port.PrimaryTransport.Address = "{23A4973A-EF2F-11D2-BF2C-00C04F682DE1}" |
Listing 19.27 demonstrates the required destination and transport settings to configure a messaging port to an ASP page.
org.LoadByName "Home Organization" Set rs = org.Applications AppHandle = 0 Do While Not rs.EOF If (rs("name") = "My Application") Then AppHandle = rs("id") Exit Do End If rs.MoveNext Loop port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Application = AppHandle port.DestinationEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN port.PrimaryTransport.Type = BIZTALK_TRANSPORT_TYPE_HTTP port.PrimaryTransport.Address = http://www.mycompany.com/submit_review.asp |
An envelope consists of a header and sometimes a footer and provides BizTalk Server with the necessary information to open inbound documents and interchanges and to create outbound documents. When BizTalk Server processes an outbound document, the properties of the messaging port envelope are used to create an interchange by encapsulating the document. Envelopes are associated with messaging ports through the Envelope property of the IBizTalkPort interface.
env.LoadFromHandle "Simple SOAP Envelope" port.Envelope = env.Handle
Associating an envelope to a port is optional. If you do choose to use an envelope, the format of the envelope must agree with the format of the document that it contains. The document format is determined by the outbound document specification of the associated channel.
An interchange control number is used to identify and track documents processed by the messaging port. You must specify an interchange control number when the associated envelope uses an X12 or EDIFACT format. The interchange control number is specified through the ControlNumberValue property of the IBizTalkPort interface. The value must be between 1 and 999999999.
port.ControlNumberValue = 42
Delimiters specify which characters are used to separate data within the envelope and documents of an interchange. You must specify a delimiter when the associated envelope uses an X12 or EDIFACT format. Delimiter lists are set through the Delimiters property of the IBizTalkPort interface. A delimiter returns a Dictionary object. Table 19.25 shows the required delimiter identifiers for X12 and EDIFACT envelopes.
Delimiter | X12 | EDIFACT |
---|---|---|
Record_delim | Yes | Yes |
Field_delim | Yes | Yes |
Subfield_delim | Yes | Yes |
Escape_char | No | Yes |
Note
Envelopes using a custom format may also require a delimiter list.
The security settings in a messaging port apply to the messaging port as well as all associated channels. If different channels need different security arrangements, you must create separate messaging ports for each channel.
The messaging port encoding type is specified through the EncodingType property of the IBizTalkPort interface. EncodingType takes one of the BIZTALK_ENCODING_TYPE enumeration values shown in Table 19.26.
port.EncodingType = BIZTALK_ENCODING_TYPE_MIME
Name | Description |
---|---|
BIZTALK_ENCODING_TYPE_NONE | No encoding |
BIZTALK_ENCODING_TYPE_MIME | Multipurpose Internet Mail Extensions (MIME) |
BIZTALK_ENCODING_TYPE_CUSTOM | Custom encoding |
Specifying a custom encoding type implies that a custom encoding component is specified in the associated BizTalk Messaging channel.
The messaging encryption type is specified through the EncryptionType property of the IBizTalkPort interface. EncryptionType takes one of the BIZTALK_ENCRYPTION_TYPE enumeration values shown in Table 19.27.
port.EncryptionType = BIZTALK_ENCRYPTION_TYPE_SMIME
Name | Description |
---|---|
BIZTALK_ENCRYPTION_TYPE_NONE | No encryption |
BIZTALK_ENCRYPTION_TYPE_CUSTOM | Custom encryption |
BIZTALK_ENCRYPTION_TYPE_SMIME | Secure Multipurpose Internet Mail Extensions (S/MIME) encryption |
Note
Open messaging ports cannot use encryption. For open messaging ports, set the encryption type to BIZTALK_ENCRYPTION_TYPE_NONE.
Specifying a custom encryption type implies that a custom encryption component is specified in the associated BizTalk Messaging channel.
The EncryptionCertificateInfo property returns an instance of an object that implements the IBizTalkCertificateInfo interface. The BizTalkCertificateInfo object contains information about the certificate that encrypts the document. Table 19.28 shows the properties of the IBizTalkCertificateInfo interface.
Name | Type | Description |
---|---|---|
Name | Property | Certificate name |
Reference | Property | Reference to the certificate in the certificate store |
Store | Property | BIZTALK_STORE_TYPE enumeration indicating which store holds the certificate |
Usage | Property | BIZTALK_USAGE_TYPE enumeration indicating the type of use for the certificate |
Note
The EncryptionCertificateInfo property is required when EncryptionType is set to BIZTALK_ENCRYPTION_TYPE_SMIME.
The Reference and Store properties of the IBizTalkCertificateInfo interface together specify a unique certificate from the certificate store. The certificate reference can be obtained from the Certificates property of the IBizTalkConfig interface. The Store property takes one of the BIZTALK_STORE_TYPE enumeration values listed in Table 19.29.
Name | Description |
---|---|
BIZTALK_STORE_TYPE_MY | Specifies the store that contains certificates authorized by your organization only |
BIZTALK_STORE_TYPE_BIZTALK | Specifies the dedicated BizTalk Server 2002 store |
The read-only Name and Usage properties of IBizTalkCertificateInfo reflect the certificate specified by the Reference and Store properties. Name contains the string name of the certificate, whereas Usage contains one of the BIZTALK_USAGE_TYPE enumeration values shown in Table 19.30.
Name | Description |
---|---|
BIZTALK_USAGE_TYPE_ENCRYPTION | Specifies an encryption certificate |
BIZTALK_USAGE_TYPE_SIGNATURE | Specifies a signature certificate |
BIZTALK_USAGE_TYPE_BOTH | Specifies an encryption and signature certificate |
For more information about certificates, refer to the “IBizTalkConfig Interface” section earlier in this chapter.
The SignatureType property specifies the type of digital signing and verification and accepts one of the BIZTALK_SIGNATURE_TYPE enumeration values shown in Table 19.31.
port.SignatureType = BIZTALK_SIGNATURE_TYPE_SMIME
Name | Description |
---|---|
BIZTALK_SIGNATURE_TYPE_NONE | No signature |
BIZTALK_SIGNATURE_TYPE_CUSTOM | Custom signature |
BIZTALK_SIGNATURE_TYPE_SMIME | S/MIME signature |
Note
Custom encoding, encryption, and signatures are only available through the BizTalk Messaging Configuration object model.
Listing 19.28 shows example code that creates two types of messaging ports.
' Create the config objects Set BT = CreateObject("BizTalk.BizTalkConfig") set org = BT.CreateOrganization Set port = BT.CreatePort ' Find the Review application handle org.LoadByName "Home Organization" Set rs = org.Applications AppHandle = 0 Do While Not rs.EOF If (rs("name") = "Restaurant Reviews") Then AppHandle = rs("id") Exit Do End If rs.MoveNext Loop ' Create a messaging port to the review request ASP page port.Name = "Restaurant Review Requests" port.Comments = "Messaging port for receiving requests to review a restaurant" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Application = AppHandle port.DestinationEndPoint.Openness = 'BIZTALK_OPENNESS_TYPE_EX_NOTOPEN port.PrimaryTransport.Type = 'BIZTALK_TRANSPORT_TYPE_HTTP port.PrimaryTransport.Address = "http://www.mycompany.com/submit_review.asp" port.Create ' Reset the objects org.Clear port.Clear ' Load Joe's orgnaization org.LoadByName "Joe's Crab Shack" ' Create a messaging port to send reviews to Joe's port.Name = "Joe's Review Results" port.Comments = "Messaging port to send a review back to Joe" port.DestinationEndPoint.Organization = org.Handle port.DestinationEndPoint.Openness = 'BIZTALK_OPENNESS_TYPE_EX_NOTOPEN port.PrimaryTransport.Type =' BIZTALK_TRANSPORT_TYPE_SMTP port.PrimaryTransport.Address = "mailto:[email protected]" port.PrimaryTransport.Parameter = "mailto:[email protected]" port.Create |
Note
The code (19newListing28.vbs) in Listing 19.28 is also available for download at the Sams Publishing Web site.
The IBizTalkChannel interface provides properties and methods for managing BizTalk Messaging channels. A BizTalk Messaging channel configures BizTalk Messaging Services to process the documents that it receives. Table 19.32 shows the properties and methods of the IBizTalkChannel interface.
Name | Type | Description |
---|---|---|
Comments | Property | User comments about the channel |
ControlNumberValue | Property | Interchange control number |
DecryptionCertificateInfo | Property | BizTalkCertificateInfo object containing information about the certificate tat decrypts the input document |
ExpectReceiptTimeout | Property | Time, in minutes, in which to expect a receipt before treating the document as expired |
Expression | Property | Equations for filtering the documents |
GetConfigComponent | Method | Gets the CLSID of the component associated with the messaging port |
GetConfigData | Method | Gets the configuration associated with the specified messaging port |
InputDocument | Property | Handle to the input document definition |
IsReceiptChannel | Property | Flag to indicate whether channel is a receipt channel |
LoggingInfo | Property | BizTalkLoggingInfo object containing information about logging |
MapContent | Property | Contents of the map specified by MapReference |
MapReference | Property | WebDAV URL specifying a document map |
OutputDocument | Property | Handle to the output document definition |
Port | Property | Handle to the associated messaging port |
PortGroup | Property | Handle to the associated distribution group |
ReceiptChannel | Property | Handle to the receipt channel for this channel |
RetryCount | Property | Number of times to retry a document submission when there is an error |
RetryInterval | Property | Interval, in minutes, between resubmission attempts |
SetConfigComponent | Method | Sets the CLSID of the component associated with the messaging port |
SetConfigData | Method | Sets the configuration associated with the specified messaging port |
SignatureCertificateInfo | Property | BizTalkCertificateInfo object containing information about the certificate that signs the output document |
SourceEndPoint | Property | BizTalkEndPoint object containing information about the document source |
TrackFields | Property | Dictionary object that stores additional tracking fields |
VerifySignatureCertificateInfo | Property | BizTalkCertificateInfo object containing information about the certificate that verifies the signature of the input document |
In addition to the properties and methods shown in Table 19.32, BizTalkChannel objects also implement the properties and methods of IBizTalkBase shown in Table 19.7.
Figure 19.8 shows a UML diagram illustrating the relationships between IBizTalkChannel and various Configuration interfaces.
A channel source specifies where source documents come from. Just like messaging port destinations, channel sources can be organizations, XLANG schedules, or applications in the Home Organization. The channel source is specified through the SourceEndPoint property of the IBizTalkChannel interface. SourceEndPoint returns an instance of an object that implements the IBizTalkEndPoint interface. Refer to Table 19.18 for a list of IBizTalkEndPoint properties.
For source organizations, the channel may specify a partner organization or leave the source open, creating an open channel. Before configuring a channel from an organization, the organization must be added to the BizTalk Messaging database. Listing 19.29 demonstrates how to configure the SourceEndPoint property for a channel from a specific partner organization.
org.LoadByName "Joe's Crab Shack" channel.SourceEndPoint.Organization = org.Handle channel.SourceEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN |
Listing 19.30 demonstrates how to configure the SourceEndPoint property to create an open channel from an organization.
channel.SourceEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_SOURCE |
Channels from XLANG schedules are by definition open. Listing 19.31 demonstrates how to configure the SourceEndPoint property for an open channel from an internal XLANG schedule.
org.LoadByName "Home Organization" channel.SourceEndPoint.Organization = org.Handle channel.SourceEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_FROMWORKFLOW |
Before configuring a channel source from an application, the application must be added to the Home Organization. Listing 19.32 demonstrates how to configure the SourceEndPoint property for a channel from an internal application.
org.LoadByName "Home Organization" Set rs = org.Applications AppHandle = 0 Do While Not rs.EOF If (rs("name") = "My Application") Then AppHandle = rs("id") Exit Do End If rs.MoveNext Loop channel.SourceEndPoint.Organization = org.Handle channel.SourceEndPoint.Application = AppHandle channel.SourceEndPoint.Openness = BIZTALK_OPENNESS_TYPE_EX_NOTOPEN |
Channels are always associated with a specific messaging port or distribution list. The messaging port or ports within the distribution list specify the document destination. To associate a messaging port or distribution list with a channel, use the Port or PortGroup properties of the IBizTalkChannel interface. The following code demonstrates these properties:
port.LoadByName "Restaurant Review Requests" channel.Port = port.Handle
or
portgroup.LoadByName "My Port Group" channel.PortGroup = portgroup.Handle
One of these properties must be set when creating a new channel. In addition, the properties are mutually exclusive. After a BizTalk Messaging channel is created in the database, the port or distribution list association cannot be changed.
BizTalk Server 2002 supports a limited number of channel (source) and messaging port (destination) combinations. In the following list of valid combinations, internal application refers to an application listed in the Home Organization or an XLANG schedule:
Trading partner to an internal application
Internal application to a trading partner
Internal application to internal application
Internal application to distribution list
Internal application to open destination
Open source to internal application
Trading partner to trading partner (where your BizTalk Server serves as an intermediary)
Note
BizTalk Server 2002 does not support an open-source channel to an open destination port combination.
Document definitions enable a channel to translate documents between their native formats and an intermediate XML format. With the inbound document in the intermediate format, the channel can map, filter, and log document fields. Input and output document specifications are specified through the InputDocument and OutputDocument properties of the IBizTalkChannel interface. For example:
doc.LoadByName "Restaurant Reviewer" channel.InputDocument = doc.Handle channel.OutputDocument = doc.Handle
Both properties are required when creating a new BizTalk Messaging channel, and neither can be changed after the channel is created. In the preceding sample, the inbound and outbound document definitions are the same. The implication is that a document map is not needed.
Caution
If the channel is an open channel—that is SourceEndPoint.Type is set to BIZTALK_OPENNESS_TYPE_SOURCE or BIZTALK_OPENNESS_TYPE_FROMWORKFLOW—then the OutputDocument property cannot specify an X12 or EDIFACT specification.
If the envelope format of the associated messaging port is X12 or EDIFACT, then an interchange control number must be specified. Custom envelope formats sometimes require an interchange control number as well. Use the ControlNumberValue property of the IBizTalkChannel interface to specify a control number. Interchange control values are between 1 and 999999999.
Inbound document decryption certificates and digital signature verification certificates are specified through the DecryptionCertificateInfo and VerifySignatureCertificateInfo properties of the IBizTalkChannel interface, respectively. Both properties return an instance of an object that implements the IBizTalkCertificateInfo interface.
Refer to Table 19.28 for a list of IBizTalkCertificateInfo properties.
Outbound documents can be signed by BizTalk Server using a digital signature certificate. To specify a signature certificate, use the SignatureCertificateInfo property of the IBizTalkChannel interface. This property returns an instance of an object that implements the IBizTalkCertificateInfo interface.
Refer to Table 19.28 for a list of IBizTalkCertificateInfo properties.
Sometimes the format of the inbound document specification does not match the format of the outbound document specification. When this occurs, a map is needed to translate the inbound document into the format of the outbound document. Maps are created using BizTalk Mapper and are specified in the IBizTalkChannel interface through the MapReference property. MapReference takes a string containing the full WebDAV URL of the associated map file. For example:
channel.MapReference = http://somemachine/BizTalkServerRepository/Maps/map.xml
Document definitions can specify fields within the document that are logged to the Tracking database. Channels can override the fields specified by the document definition with a set of channel-specific tracking fields. When this occurs, the channel-specified fields are logged in lieu of the global tracking fields defined by the document specification.
Note
Tracking applies only to inbound documents.
To specify tracking fields in a channel, use the TrackFields property of the IBizTalkChannel interface. TrackFields returns an instance of the Dictionary object. Listing 19.33 shows sample code with XLANG tracking fields.
Refer to the “IBizTalkDocument Interface” section earlier in this chapter for more information about tracking fields.
channel.TrackFields.r_value1 = "/CommonPO/SpecialCharge/@Amount" channel.TrackFields.r_value2 = "/CommonPO/Currency/@ExchangeRate" channel.TrackFields.s_value1 = "/CommonPO/TermsOfSale/@PaymentMethod" channel.TrackFields.s_value2 = "/CommonPO/CarrierDetail/@Routing" channel.TrackFields.i_value1 = "/CommonPO/TermsOfSale/@NetDays" channel.TrackFields.i_value2 = "/CommonPO/TermsOfSale/@DiscountDaysDue" channel.TrackFields.d_value1 = "/CommonPO/Item/DateReference/@Date" channel.TrackFields.d_value2 = "/CommonPO/POHeader/@CreationDate" channel.TrackFields.x_custom_search.Add "/CommonPO/Total/@LineItemTotal" channel.TrackFields.x_custom_search.Add "/CommonPO/Total/@QuantityTotal" channel.TrackFields.x_custom_search.Add /CommonPO/Total/@POTotal |
A channel filter provides a mechanism for determining when a channel should be invoked. When BizTalk Server receives a document, the filtering expression is evaluated against the values of the specified fields in that document. If the expression evaluates to true, the channel is invoked. If the expression evaluates to false, the channel is not invoked.
Use the Expression property of the IBizTalkChannel interface to specify a filtering expression.
BizTalk Server allows channels to specify whether and how inbound and outbound documents are logged. To configure logging options, use the LoggingInfo property of the IBizTalkChannel interface. LoggingInfo returns an instance of an object that implements the IBizTalkLoggingInfo interface. Table 19.33 shows the properties on the IBizTalkLoggingInfo interface.
Name | Type | Description |
---|---|---|
LogNativeInputDocument | Property | Flag to indicate whether the input document is logged in its native format |
LogNativeOutputDocument | Property | Flag to indicate whether the output document is logged in its native format |
LogXMLInputDocument | Property | Flag to indicate whether the XML input document is logged |
LogXMLOutputDocument | Property | Flag to indicate whether the XML output document is logged |
BizTalk Server allows channels to override certain messaging port properties associated with the transport; the document serializer; and custom encoding, encryption, and signature verification. This functionality is exposed in the Configuration object model through the following IBizTalkChannel methods:
GetConfigComponent
GetConfigData
SetConfigComponent
SetConfigData
Each of these methods takes as a parameter a BIZTALK_CONFIGDATA_TYPE enumeration value. The value indicates the messaging data being requested or changed. Table 19.34 shows the BIZTALK_CONFIGDATA_TYPE enumeration values.
Name | Description |
---|---|
BIZTALK_CONFIGDATA_TYPE_PRIMARYTRANSPORT | Configure the primary transport |
BIZTALK_CONFIGDATA_TYPE_SECONDARYTRANSPORT | Configure the secondary transport |
BIZTALK_CONFIGDATA_TYPE_ENCRYPTION | Configure the encryption certificate |
BIZTALK_CONFIGDATA_TYPE_ENCODING | Configure the encoding type |
BIZTALK_CONFIGDATA_TYPE_SIGNATURE | Configure the signature verification |
BIZTALK_CONFIGDATA_TYPE_SERIALIZER | Configure the serializer |
The GetConfigComponent method returns the CLSID of the associated component for the specified BIZTALK_CONFIGDATA_TYPE enumeration value.
The SetConfigComponent method sets the CLSID of the component associated with the messaging port. This method is used to specify components that implement custom encryption, encoding, or signature verification. SetConfigComponent is also used to specify a custom serializer when the messaging port envelope is set to the custom format. You cannot change the transport components associated with the messaging port.
The GetConfigData method returns a Dictionary object containing values specific to the configuration component returned by GetConfigComponent(). It is not necessary to get the CLSID of the configuration component before calling GetConfigData().
Note
Changes made through the SetConfigData method apply only to the channel where those changes were made.
Transport components are associated with messaging ports based on the transport type of the associated primary or secondary transport. The GetDataComponent method returns the CLSID of the associated transport component. Table 19.35 shows the transport components that ship with BizTalk Server 2002.
Transport Type | ProgID for Transport Component |
---|---|
File | BizTalk.SendLocalFile |
HTTP/HTTPS | BizTalk.SendHTTPX |
MSMQ | BizTalk.SendMSMQ |
SMTP | BizTalk.SendSMTP |
Orchestration activation | BizTalk.BPOActivation |
The transport component for AIC transports is the Application Integration Component itself.
A channel cannot override which transport component is associated by the messaging port. What can be changed are specific properties of the transport component. The following sections discuss the transport types that can be customized through the GetConfigData and SetConfigData methods.
The settings associated with an HTTP/HTTPS transport on a messaging port only specify the destination URL. When the destination URL requires login information or BizTalk Server requires a proxy server (because the server itself sits behind a firewall), the configuration data in the associated channel must be used. Table 19.36 shows the dictionary fields used by the HTTP/HTTPS transport component.
Field Name | Description |
---|---|
ClientCert | Reference to the certificate used for HTTPS transports |
ContentType | Content-Type HTTP/HTTPS header value |
MaxRedirects | Maximum number of redirects allowed |
Password | Password for the specified destination URL |
ProxyName | URL of the proxy server |
ProxyPassword | Proxy server password |
ProxyPort | Port to use on the proxy server |
ProxyUserName | Proxy server login name |
RequestTimeout | Request timeout value in seconds |
URL | Destination URL, indicates the address of the transport specified in the messaging port (cannot be changed) |
UseProxy | Specifies whether to use a proxy server (-1 for True, 0 for False) |
UserName | Login name for the specified destination URL |
The settings associated with an SMTP transport on a messaging port specify only the destination and return e-mail addresses. The SetConfigData method allows a channel to specify SMTP server information, additional e-mail header values, and character sets. Table 19.37 shows the dictionary fields used by the SMTP transport component.
Field Name | Description |
---|---|
CC | Additional e-mail addresses to forward the document to |
CharSet | Character set |
From | Return e-mail address, must be prefixed with mailto: |
SMTPAuthenticate | Type of authentication to use (0 for no authentication, 1 for basic authentication, 2 for NTLM authentication) |
SMTPHost | SMTP server |
SMTPSendPassword | SMTP server password |
SMTPSendUserName | SMTP server login name |
Subject | E-mail subject line |
To | Destination e-mail address, indicates the address of the transport specified in the messaging port (cannot be changed) |
The settings associated with a File transport on a messaging port specify only the destination file. The SetConfigData method allows a channel to specify how the file should be written and to specify a Windows username and password. Table 19.38 shows the dictionary fields used by the File transport component.
Field Name | Description |
---|---|
CopyMode | Indicates how the file should be written (0 to overwrite an existing file, 1 to append to an existing file, 2 to create a new file) |
FileName | Destination filename, indicates the address of the transport specified in the messaging port (cannot be changed) |
Password | Windows login password |
Username | Windows login username |
The settings associated with an MSMQ transport on a messaging port specify only the destination queue. The SetConfigData method allows a channel to specify specific MSMQ properties. Table 19.39 shows the dictionary fields used by the MSMQ transport component.
Field Name | Description |
---|---|
AuthLevel | Indicates whether the message needs to be authenticated (0 for no authentication, 1 to always authenticate, 2 for MSMQ 1.0 signature, 3 for MSMQ 2.0 signature) |
Delivery | Delivery method (0 to indicate message resides in memory only, 1 to back up message until it is delivered) |
Journal | Journal (0 for none, 1 for the Dead Letter queue) |
MessageLabel | Message label |
Password | Windows login password |
Priority | Message priority (integer from 0 to 7, where higher values indicate higher priority) |
QueueName | Destination queue, indicates the address of the transport specified in the messaging port (cannot be changed) |
Transactional | Indicates whether message is transactional (0 for non-transactional, 1 for COM+ transactions, 2 for Single Message transactions) |
Username | Windows login username |
Table 19.40 shows the dictionary fields used by the orchestration activation transport component.
Field Name | Description |
---|---|
Port | Destination orchestration port within the specified schedule |
SkedFile | Destination schedule, indicates the address of the transport specified in the messaging port (cannot be changed) |
AIC components can specify their own dictionary fields as needed. There are no standard fields for AIC components. Refer to the AIC documentation for a list of appropriate dictionary fields.
Serializers are associated with messaging ports based on the format of an associated envelope. Use the SetDataComponent method to specify a custom serializer. Table 19.41 shows the serializers that ship with BizTalk Server 2002.
Envelope Format | ProgID for Serializer |
---|---|
custom xml | BizTalk.SerializerXML |
edifact | BizTalk.SerializerEdifact |
flatfile | BizTalk.SerializerFFile |
reliable | BizTalk.Scriptor |
x12 | BizTalk.SerializerX12 |
The EDIFACT and X12 document serializers expose Dictionary objects for customizing the serialization process via the GetConfigData method. Tables 19.42 and 19.43 show the dictionary fields for the built-in EDI serializers.
Field Name | Description |
---|---|
SerializerEdifact_AckRequest | Acknowledge ment request |
SerializerEdifact_AgreementID | Interchange agreement identifier |
SerializerEdifact_ApplicationRef | Application reference |
SerializerEdifact_ProcPriCode | Processing priority code |
SerializerEdifact_RecipientIntID | Interchange Recipient internal identification |
SerializerEdifact_RecipientIntSubID | Interchange recipient internal subidentification |
SerializerEdifact_RecipentRefPwd | Recipent reference and password |
SerializerEdifact_RecipientRefPwdQual | Recipient reference and password qualifier |
SerializerEdifact_SenderIntID | Interchange sender internal identification |
SerializerEdifact_SenderIntSubID | Interchange sender internal subidentification |
SerializerEdifact_SyntaxID | Syntax identifier, can be one of the following strings: UNOA, UNOB, UNOC, UNOD, UNOE, UNOF, UNOG, UNOH, UNOI, UNOJ, UNOK |
SerializerEdifact_TestInd | Test indicator |
SerializerEdifact_UNACtrl | UNA Control, 0 to indicate “Send UNA only when required” and 1 to indicate “Send UNA always” |
Field Name | Description |
---|---|
SerializerX12_AckRequired | Acknowledgement required (0 for no, 1 for yes) |
SerializerX12_AuthInfo | Authorization information |
SerializerX12_AuthInfoQual | Authorization information qualifier |
SerializerX12_CtrlStdID | Interchange control standards identifier |
SerializerX12_CtrlVerNum | Interchange control number version |
SerializerX12_SecInfo | Security information |
SerializerX12_SecInfoQual | Security Information qualifier |
SerializerX12_UseInd | Usage indicator |
Custom encryption, encoding, and signature verification requires that components that implement the custom functionality be specified through the SetConfigComponent method of the IBizTalkChannel interface. In addition, these custom components may expose customization options via a Dictionary object returned from GetConfigData.
The IBizTalkPortGroup interface provides properties and methods for managing BizTalk Messaging distribution lists. A BizTalk Messaging distribution list is a group of BizTalk Messaging ports that enable BizTalk Server to deliver a single document to multiple destinations with a one-document submission. Table 19.44 shows the properties and methods of the IBizTalkPortGroup interface.
Name | Type | Description |
---|---|---|
AddPort | Method | Adds a port to the distribution list |
Channels | Property | ADO recordset containing information about all associated channels |
Ports | Property | ADO recordset containing information about all ports in the port group |
RemovePort | Method | Removes a port from the distribution list |
In addition to the properties and methods shown in Table 19.44, BizTalkPortGroup objects also implement the properties and methods of IBizTalkBase shown in Table 19.7.
Figure 19.9 shows a UML-style diagram illustrating the relationships between IBizTalkPortGroup and various Configuration interfaces.
BizTalk Server enforces two rules when adding ports to a distribution list:
The messaging port Openness property must be set to BIZTALK_OPENNESS_TYPE_EX_NOTOPEN.
Duplicate ports cannot be added to the same distribution list.
Use the AddPort method of the IBizTalkPortGroup interface to add a port to the distribution list. The following sample code demonstrates how to add a port to a distribution list:
port.LoadByName "Restaurant Review Requests" group.AddPort = port.Handle group.Save
Note
After adding or removing ports from a BizTalkPortGroup object, you must call Save or Create to persist the new port list to the database.
Use the RemovePort method of the IBizTalkPortGroup interface to remove a messaging port from a distribution list. The following sample code demonstrates how to remove a port from a distribution list:
port.LoadByName "Restaurant Review Requests" group.RemovePort = port.Handle group.Save
Note
Distribution lists are required by BizTalk Server to contain at least one associated messaging port. As such, the last port in a distribution list cannot be removed. Instead, you must remove the entire distribution list.