Pseudo Knowledge Base

Useful stuff I've collected... Enjoy.
posts - 26 , comments - 34 , trackbacks - 0

Getting Document Values from Repeating Nodes in BizTalk

To access a variable in a document in BizTalk is quite easy. First you go to the schema of the document and right click on the value you want to promote. Select Promote -> Show Promotions. To promote the variable as a distinguished property simply click the add button. If you messages are in a separate project make sure you build the solution before continuing. Accessing the promoted property in the orchestration is a simple process. Typing the message name, that represents the schema, in an expression shape. Intellisense will then guide you the rest of the way.
Now try that if the document variable that you require can have multiple values. As soon as you try to promote the field BizTalk will refuse to continue displaying the following dialog.
Currently I’m in the situation where I need that variable to start my mapping process. To get over this problem I have written a helper function is C#. The class is easily accesses from the orchestration. Simply reference the helper class project in the project that contains the orchestration. 
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Microsoft.XLANGs.BaseTypes;
using System.Configuration;
using System.IO;
namespace CustomerIntegration2.PAPINET.MessagingSupport
    public class Helper
In an expression shape reference the helper class as shown below
CustomerNumber = CustomerIntegration2.PAPINET.MessagingSupport.Helper.GetCustomerID()
To allow the method to do its work it needs the message data.  To achieve this I’m using an XPath query to grab the section of the message I need to process.  In this case I’m also passing in mapping data as I need to convert the value to a customer ID.  ‘BuyerDoc’ is a declared variable, of type System.Xml.XmlDocument, in the orchestration.
BuyerDoc = xpath(PAPINetPO, "/*[local-name()='PurchaseOrder']/*[local-name()='PurchaseOrderHeader']/*[local-name()='BuyerParty']");

Print | posted on Thursday, November 13, 2008 5:48 PM |


No comments posted yet.
Post A Comment

Powered by: