简体   繁体   中英

How to loop in orchestration BizTalk 2010

I'm looking to loop data received from SQL Server data received from wcf-sql adapter.

I use for loop and and the following

itostring=i.ToString();
MessageOne=xpath(MessagePolling,"/*[local-name()='MainData' and namespace-uri()='http..["+itostring+"]");

When the XPath in for the first receive message path[i]

Is this the correct way?

There are two ways^ to loop on multiple records contained within an Xml message received by BizTalk:

Envelope Schemas

When you define the schema that represents the message, mark it as an Envelope Schema. This tells the Receive Pipeline Disassembler to create (and publish) one message to the BizTalk Message Box for each record in the incoming message (in your case from the WCF-SQL Adapter). This will cause a single Orchestration instance to be started for each record in your incoming message.

Richard Seroter has a great blog post on doing this from the WCF-SQL Adapter - http://seroter.wordpress.com/2010/04/08/debatching-inbound-messages-from-biztalk-wcf-sql-adapter/

Be aware that with this approach, you don't want to be de-batching tens of thousands of records from the incoming message as BizTalk will grind to a halt :-)

XPath Inside an Orchestration

If you do not use an Envelope Schema, you will start a single Orchestration instance for the incoming message (containing multiple records). Within an Expression Shape in your Orchestration, you can use XPath (and some other magic) to loop around each record an extract each to an Orchestration variable (which you can then map on etc.)

Take a look at the following links that will help you with extracting via XPath:

^There is also a third way to achieve this as of BizTalk Server 2009 (I think - it seems like so long ago) whereby you can execute a Receive Pipeline within an Orchestration, so you could perform your Envelope de-batching in an Orch, instead of a Receive Location's Receive Pipeline.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM