Logo
CAR REVIEW
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Server

BizTalk 2010 Recipes : Document Schemas - Promoting Properties

3/25/2011 10:10:48 PM

1. Problem

You have a scenario where you want to subscribe to a message differently based on the contents or context of the message, and you need to understand how BizTalk Server exposes this metadata.

2. Solution

In order to promote instance-specific data fields (data that resides in the actual message instances, such as a customer name or the ID of an order), you must create a property schema. You then promote the specific schema elements, attributes, or records you need to subscribe to into the property schema. This task is accomplished in Visual Studio, and can be done in one of two ways: quick promotion and regular promotion. 

In addition to instance-specific data fields, a number of system- or exchange-specific properties are automatically promoted by BizTalk Server. A description of these exchange-specific properties, and the fundamental difference between them and instance-specific properties.

All properties that have been promoted, regardless of whether they are associated with a specific instance or the message exchange in general, are available for subscription by other BizTalk Server objects, including send ports, send port groups, and orchestrations. Promoted properties are also available for tracking purposes, which allow them to be used in troubleshooting and reporting.

3. How It Works

The importance of promoted properties in BizTalk Server's publish/subscribe architecture cannot be overstated. Understanding how they work is absolutely critical when designing and building an integration solution.

From a simplistic perspective, a publish/subscribe integration architecture involves source systems publishing or outputting messages to a centralized hub. After the hub receives these messages, it delivers them to the destination, or subscribing, systems. Within BizTalk Server, promoted properties are the key data that determine which messages are delivered to subscribing systems or processes. Without promoted properties, messages would be received by BizTalk Server, but they would not be sent out, resulting in a sort of black hole of messages. This would obviously not be a good situation, and BizTalk Server will actually throw an error if a message is received without having a system or process that subscribes to it. This keeps with the theory that it is not a good idea for a publish/subscribe integration hub to accept messages for which it does not have a subscriber.

A term that is commonly used to describe a message's promoted properties is message context. The message context includes all the instance-specific and exchange-specific data fields and essentially is the metadata that the messaging engine of BizTalk Server uses to process messages. As previously noted, instance-specific properties are those that pertain to a specific message instance, and they must be promoted explicitly during development. A common example of this type of property is an XML element containing a unique ID, which may capture an important data field such as an order number. From a message schema, XML elements, attributes, and records may be promoted.

NOTE

In order for an XML record to be promoted, its ContentType property must be set to SimpleContent. All promoted properties, regardless of whether they are populated by XML elements, attributes, or records, have a maximum length of 255 characters.

Along with being the key data elements allowing message subscription, promoted properties are also commonly used in orchestrations to determine business process. Orchestrations can handle messages dynamically by interrogating promoted properties that hold key metadata elements of a message. For example, sales orders being delivered domestically may need to be handled differently than those being sent overseas. By capturing the destination country of an order in the document schema and flagging the element as a promoted property, this data element can easily be used as a decision point in the orchestration. Domestic orders could be handled on one branch of decision logic, and international orders handled on another. It is important to note here that as an alternative to using promoted properties, the actual XML message could be interrogated within the orchestration to determine the destination of a sales order. While this method could be used, leveraging promoted properties simplifies programming and has performance benefits, as promoted properties can be accessed directly without incurring the cost of opening the entire XML message.

For additional performance gains, distinguished fields can be used as opposed to promoted properties within orchestrations. Distinguished fields provide functionality similar to promoted properties (allowing access to instance- or exchange-specific metadata items on a message), with a few key differences:

  • Distinguished fields are available only within a single orchestration instance, and they are not available to other BizTalk Server objects, such as receive locations, send ports, send port groups, and tracking utilities.

  • Distinguished fields can be of any length; promoted properties have a maximum length of 255 characters.

  • Distinguished fields have less of a performance impact than promoted properties, as they are not persisted to the MessageBox database. Instead, they are essentially XPath aliases, which simply point to the appropriate XML data field. Additionally, adding the DistinguishedField attribute to a field on a .NET class allows it to be exposed as a distinguished field.

  • Distinguished fields are accessed through a reference to the name of the message, the name of the record structure containing the distinguished field (which could include multiple levels of child records), and the name of the distinguished field, with each named item separated by periods: MessageName.RecordName.ChildRecordName.DistinguishedFieldName. Promoted properties, on the other hand, are accessed through a reference to the name of the message, the name of the property schema, and a name of the promoted property, via the following format:

    MessageName(PropertySchemaName.PromotedPropertyName).

Certain scenarios will call for sensitive information, such as a bank account number, to be used as a promoted property. To allow for enhanced troubleshooting and detailed reporting, promoted properties can be viewed in tools such as the Group Hub reports in the BizTalk Admin Console and Business Activity Monitor (BAM). Based on privacy regulations, these data fields may need to be hidden from these tools, which can be accomplished by setting the promoted property's Sensitive Information property to True (this configuration is applied on the property schema).

System- or exchange-specific properties are those that are automatically promoted by BizTalk Server and allow the successful processing of those documents by the messaging engine. The fundamental difference between the two types of properties is that exchange-specific properties can all be determined without looking into the actual contents, or payload, of the message. Instance-specific properties, on the other hand, are all populated with actual values within a message instance.

Exchange-specific properties come in various types. Table 1 lists the default exchange-specific property types that come with a complete installation of BizTalk Server. Additional properties may be added as other BizTalk related items are installed, such as the MQ Series adapter.

Table 1. Default Exchange-Specific Property Types
TypeDescription
BizTalk Framework (BTF2)Properties that support the BizTalk Framework. These are very rarely used in the routing of documents.
BizTalk Server (BTS)Properties that support core BizTalk Server messaging. These are extremely common in routing and include things like ReceivePortName and other standard properties that are useful to route on.
EDI (EDI)These are the base EDI properties are available when the BizTalk EDI components have been installed. They include envelope information, party information, and other data related to EDI message processing.
AS2 (EdiIntAS)These properties are related to AS2 (also known as EDI over the Internet) messages and are available on messages processed using the AS2 protocol.
EDI Override (EDIOverride)These properties are used primarily to override the values of EDI messages at runtime. They include envelope segments and several other related properties.
Error Reporting (ErrorReport)Properties that support error reporting and handling. These are used when subscribing to documents that have failed on ports that have been enabled for routing of failed documents.
Legacy (LEGACY)Properties that support BizTalk Server 2002 properties.
Message Tracking (MessageTracking)Properties that support message tracking.
Orchestration (Microsoft.BizTalk.XLANGs.BTXEngine)Properties that support the BizTalk Server orchestration engine.
MIME (MIME)Properties that support the processing of MIME-encoded messages.
Various BizTalk Adapters (FILE, FTP, HTTP, MQSeries, MSMQ, MSMQT, POP3, SMTP, SOAP, SQL, WCF, WSS, etc.)Properties that support the different adapters, both standard (such as File and FTP) and third-party adapters. These properties are available for documents that have been processed using the specific adapter (for example, if a message was received on a File adapter, the file promoted properties will be populated).
XML Document (XMLNorm)Properties that support the processing of XML documents.

BizTalk Server processes promoted properties as messages are received into or sent out of the MessageBox. Specifically, pipelines handle this task. System- or exchange-specific properties are promoted by default, through pipelines such as XML or PassThru (both the receive and send variety). For instance-specific properties to be promoted, a pipeline other than the PassThru must be used, as this pipeline does not attempt to match messages to their associated schemas (and therefore property schemas).

As properties are promoted, their XSD data types are converted to Common Language Runtime (CLR) data types. Table 2 shows XSD data types and their associated CLR data types.

Table 2. XSD Data Types and Associated CLR Data Types
XSDCLRXSDCLR
anyURIStringNameString
BooleanBooleanNCNameString
bytesbytenegativeIntegerDecimal
dateDateTimeNMTOKENString
dateTimeDateTimenonNegativeIntegerDecimal
decimalDecimalnonPositiveIntegerDecimal
doubleDoublenormalizedStringString
ENTITYStringNOTATIONString
floatSinglepositiveIntegerDecimal
gDayDateTimeQNameString
gMonthDateTimeshortInt16
gMonthDayDateTimestringString
IDStringtimeDateTime
IDREFStringtokenString
intInt32unsignedByteByte
integerDecimalunsignedIntUint32
languageStringunsignedShortUint16

In addition to pipelines, orchestrations may also be used to explicitly set promoted properties. This is important if your business process requires the copying or creation of messages. Since messages are immutable (meaning once a message has been created, it cannot be modified) in BizTalk Server, a new message must be created prior to any of its promoted properties being set. When a message is constructed in an orchestration as a copy of another message, the message context (its promoted properties), by default, are all copied to the new message. Once this new message is created, its properties may be explicitly set to something different than in the original message. This must be done in the same Message Assignment shape in the orchestration as the duplicate message.

NOTE

When a copy of a message is created in an orchestration, it is important to consider how the properties on the original message are configured. If any of its properties are configured to use MessageContextPropertyBase for the Property Schema Base (a property of the promoted field found in the property schema), they will not be copied to the new message in the orchestration. By contrast, all those properties that are configured to use the MessageDataPropertyBase (the default value) for the Property Schema Base will be copied to the new message. 
Other -----------------
- BizTalk 2010 Recipes : Creating Schema Namespaces
- BizTalk 2010 Recipes : Creating a Schema Based on an Existing XML Document
- BizTalk 2010 Recipes : Creating Simple Document Schemas
- Restoring Windows Server 2008 (part 2) - Restoring Individual Components
- Restoring Windows Server 2008 (part 1) - Full Server Recovery
- Installing and Configuring Office Web Apps for SharePoint 2010 (part 2)
- Installing and Configuring Office Web Apps for SharePoint 2010 (part 1)
- Office Web Apps Integration with SharePoint 2010 : Planning for Office Web Apps Use
- Windows Server 2008 R2 : Planning Domain Group Policy Objects (part 2)
- Windows Server 2008 R2 : Planning Domain Group Policy Objects (part 1) - Policies and Preferences
- Windows Server 2008 R2 : Planning Workgroup and Standalone Local Group Policy Configuration
- Exchange Server 2010 : Components of a Secure Messaging Environment (part 3) - Using Email Disclaimers
- Exchange Server 2010 : Components of a Secure Messaging Environment (part 2)
- Exchange Server 2010 : Components of a Secure Messaging Environment (part 1) - Hardening Windows Server 2008
- Considering the Importance of Security in an Exchange Server 2010 Environment
- Installing BizTalk Server RFID 2010
- BizTalk Server 2010 : Configuring EDI Trading Partners
- BizTalk Server 2010 : Accessing the EDI Version 5010 HIPAA Schemas
- Exchange Server 2010 : Managing Recipients and Distribution Groups (part 2) - Distribution Groups
- Exchange Server 2010 : Managing Recipients and Distribution Groups (part 1) - Mail Contacts & Mail-Enabled Users
 
 
Most view of day
- Microsoft Visio 2010 : Finding and Managing Shapes (part 3)
- Microsoft Excel 2010 : Protecting and Securing a Workbook - Adding Security Encryption to a Workbook
- System Center Configuration Manager 2007 : Network Design - Troubleshooting Configuration Manager Network Issues (part 2) - Identifying Network Issues Affecting Configuration Manager
- Microsoft Lync Server 2013 : Director Troubleshooting (part 2) - DNS Records, Logs
- Maintaining Dynamics GP : Speeding security setup with User Copy
- System Center Configuration Manager 2007 : Network Design - Use of BITS
- Integrating SharePoint 2013 with the Office Applications (part 7) - Microsoft Access - Access Services
- SQL Server 2012 : Understanding Latches and Spinlocks (part 1) - Latching Example
- Microsoft Dynamics CRM 2011 : Using Advanced Find (part 1) - Performing Advanced Find Queries
- Monitoring Windows Small Business Server 2011 : Using Event Viewer
Top 10
- Microsoft Lync Server 2013 : Director Troubleshooting (part 3) - Synthetic Transactions,Telnet
- Microsoft Lync Server 2013 : Director Troubleshooting (part 2) - DNS Records, Logs
- Microsoft Lync Server 2013 : Director Troubleshooting (part 1) - Redirects, Certificates
- Microsoft Lync Server 2013 : Administration of the Director Role (part 4) - Services Management, Client Version Filter
- Microsoft Lync Server 2013 : Administration of the Director Role (part 3) - Topology Status
- Microsoft Lync Server 2013 : Administration of the Director Role (part 2) - Ports,Firewall Rules
- Microsoft Lync Server 2013 : Administration of the Director Role (part 1) - Services
- Microsoft Lync Server 2013 : Configuring the Director (part 2) - Web Services Ports,Reverse Proxy
- Microsoft Lync Server 2013 : Configuring the Director (part 1) - SRV Records, Web Services FQDN Overrides
- Sharepoint 2013 : SharePoint Designer 2013 (part 2) - Locking Down SharePoint Designer
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro