本文介绍了如何在业务流程BizTalk 2010中循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找循环从wcf-sql适配器接收到的SQL Server数据的数据.

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

我使用for循环和以下

I use for loop and and the following

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

当XPath进入第一个接收消息路径时[i]

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

这是正确的方法吗?

推荐答案

有两种方法^循环BizTalk收到的Xml消息中包含的多个记录:

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

信封架构

定义代表消息的架构时,请将其标记为信封架构.这告诉接收管道反汇编程序为传入消息中的每个记录(在您的情况下是从WCF-SQL适配器创建)向BizTalk消息框创建(并发布)一条消息.这将导致为传入消息中的每个记录启动一个Orchestration实例.

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在WCF-SQL Adapter上有一篇很棒的博客文章-

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/

请注意,使用这种方法,您不想从传入消息中分拆成千上万条记录,因为BizTalk会停止运行:-)

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

如果不使用信封架构,则将为传入消息(包含多个记录)启动一个Orchestration实例.在Orchestration中的Expression Shape中,您可以使用XPath(以及其他一些魔术)在每个记录周围循环,将每个记录提取到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.)

看看下面的链接,这些链接将帮助您通过XPath进行提取:

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

  • http://social.technet.microsoft.com/wiki/contents/articles/6944.biztalk-orchestrations-xpath-survival-guide.aspx
  • http://www.biztalkgurus.com/biztalk_server/biztalk_blogs/b/biztalk/archive/2004/10/25/using-xpath-inside-biztalk-orchestrations.aspx
  • http://blog.eliasen.dk/2006/11/05/LoopingAroundElementsOfAMessage.aspx
  • http://www.codeproject.com/Articles/534627/BizTalk-Looping-through-repeating-message-nodes-in

^从BizTalk Server 2009开始,还有另一种方法可以实现此目的(我认为-似乎很久以前),您可以在业务流程中执行接收管道,以便可以在其中执行信封分批处理. Orch,而不是接收位置的接收管道.

^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.

这篇关于如何在业务流程BizTalk 2010中循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 10:44