For more information, see the BizTalk hands-on experiment series directory.
BizTalk Development Series
When Routing Based on the message content, it is often used to distinguish fields and attribute fields. Attribute fields can be accessed in various BizTalk Server components (including pipelines and business processes. Attribute fields can also be used for message routing. To access the upgraded message data in the context (rather than in the Business Process), you must create one or more attribute architectures to describe the data to be upgraded.
Each attribute in the message context consists of the name, namespace, and value. For example:
<Property Name = "InterchangeID" Namespace = http://schemas.microsoft.com/BizTalk/2003/system-properties Value = "{AC07BF30-2F1A-42B0-8390-191EF38BA839}"/>
Now let's talk about the use of attribute fields. To upgrade attributes, you need to create an attribute architecture. All attribute upgrades are completed through the "upgrade attributes" dialog box. You can access this dialog box by using the "upgrade attribute" of the Schema node in the message architecture.
1. Create an attribute Architecture
Attribute architecture is a special architecture associated with the message architecture. It is used to upgrade a specific value in the instance message to the Message context. Attribute upgrade provides a centralized mechanism through which you can request key information defined in the instance message, and makes it easier to be accessed by the BizTalk Server component responsible for processing messages through the BizTalk Server.
2. Upgrade attribute Fields
In the "upgrade attributes" dialog box, make sure that the "attribute fields" tab on the right of the selected dialog box is selected. Then, make sure that the property architecture is included in the "Property schema list" at the top of the "property fields" tab. If necessary, use the folder button to select the attribute architecture in the BizTalk type selector dialog box.
Next, select the "field element" node or "field attribute" node that you want to upgrade to the attribute field in the tree on the left of the displayed dialog box, and click "add ". Finally, use the drop-down list in the "attribute" column of the "property-field Dictionary" table to select the "field element" Node associated with the upgrade attribute in the property architecture.
3. Use of attribute Fields
After setting the association between an attribute field and a schema element or attribute, you can access or set the value of this attribute by accessing the context attribute of the message. Note that the message architecture is consistent with that of the upgraded attribute field.
You can upgrade the "record" node in the property architecture to a "field element" node, however, this operation can be performed only when the "content type" attribute of the "record" node is set to SimpleContent.
In a single architecture, you can upgrade the same attribute multiple times, as long as all these upgrades are performed under different root nodes. This is because the message is verified based on a single root node. Only attributes upgraded under the root node will be evaluated during runtime.
Two parts will be added after being upgraded to the property
4. Test the property Field and Its Application in Routing
Input XML Message
<ns0:Root xmlns:ns0="http://MultiPartMsgTest.Sch_One2"> <Field1>Field1_0</Field1> <Field2>Field2_0</Field2> </ns0:Root>
Use the upgrade attribute in the filter of the sending port to route messages.
Set different output file names in the sender Port
Verify Message Processing
5. difference between a distinguished field and an attribute Field
The following table lists the differences between attribute fields and distinguished fields. If you need more flexible content-based routing, you can use Attribute fields, if only the key node value is read and assigned, the field can be distinguished.
Attribute |
Attribute Field |
Distinguished Field |
IsPromoted attributes |
True |
False |
Size Limit |
255 characters |
Unlimited |
Used for Routing |
Yes |
No |
Used for tracking |
Yes |
No |
Used in business processes |
Yes |
Yes |
Attribute architecture required |
Yes |
No |
Access through pipelines and ports |
Yes |
No |
Reference BizTalk Server 2006 Documentation