BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in .NET XML, System.XML

 
 
Page 977 of 20224

Getting Document Values from Repeating Nodes in BizTalk

Blogger : Geekswithblogs.net
All posts : All posts by Geekswithblogs.net
Category : .NET XML, System.XML
Blogged date : 2008 Nov 14

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']");


Read comments or post a reply to : Getting Document Values from Repeating Nodes in BizTalk
Page 977 of 20224

Newest posts
 

    Email TopXML