开发者

How to create an array of records in BizTalk

开发者 https://www.devze.com 2023-04-04 05:35 出处:网络
I have an xsd type wh开发者_运维问答ich consists of some elements. One of the elements is defined like

I have an xsd type wh开发者_运维问答ich consists of some elements. One of the elements is defined like <xs:element name="Parameters" type="ParametersType" /> where ParametersType is

<xs:complexType name="ParametersType">
    <xs:sequence>
        <xs:element name="Parameter"
                    type="ParameterType"
                    minOccurs="0"
                    maxOccurs="unbounded" />
        <xs:element name="UserDefinedParameter"
                    type="xs:base64Binary"
                    minOccurs="0"
                    maxOccurs="1">
        </xs:element>
    </xs:sequence>
</xs:complexType>

That is, I have an array of Parameter type records. So I have 2 questions so far:

  1. Ноw to initialize such array and how to work with it in Expression block;
  2. How to tune mapping from incoming message of the same type to my message?


When we talk about arrays here we are really talking about nested, repeatable nodes within your message.

One solution is to decompose your array inside a loop in your orchestration.

This is not simple, but here is an example:

How to create an array of records in BizTalk

The code inside the various expression shapes:

Inside "Count array items"

intCountArrayItems = xpath(MyMessage, "count(XpathToParameterNodeInYourMessage)");

Inside "foreach array item"

intLoopIndex < intCountArrayItems 

Inside "Use array item"

strXPathToArrayItem = System.String.Format("XpathToParameterNodeInYourMessage[{0}]", intLoopIndex + 1);
MyXmlDocument = xpath(MyMessage, strXPathToArrayItem);
// Now you can do what you want with the xml document.

Inside "Increment loop index"

intLoopIndex = intLoopIndex + 1;

The above gives you a way to decompose an array inside your orchestration and access each of your "Paramter" types as an xml document (which you can then do stuff with).

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消