Biztalk 获取“NullPartException”使用xpath时出错

发布于 2024-12-22 05:56:23 字数 2284 浏览 6 评论 0原文

配置文件:Windows 2008 Server SP2 上的 Biztalk 2009 update 4(开发平台) 您好,当使用 xpath 使用消息构造和消息分配来映射我的输出时,代码如下:

    sXPath = System.String.Format("/*[local-name()='ProcessSalesOrder' and namespace-uri()='http://www.TestSchemas.net/TestSchemas_V2_2/schemas']/*[local-name()='header' and namespace-uri()='http://www.TestSchemas.net/TestSchemas_V2_2/schemas']/*[local-name()='detail' and namespace-uri()='http://www.TestSchemas.net/TestSchemas_V2_2/schemas' and position()={0}]", nLoopCount);
    System.Diagnostics.Debug.WriteLine(sXPath);
    SingleInput = xpath(Input, sXPath);

我在事件查看器中收到异常;

    Exception thrown from: segment 1, progress 15
    Inner exception: The part 'part' of message 'SingleInput' contained a null value at the end of the construct block.

    Exception type: NullPartException
    Source: Microsoft.XLANGs.Engine
    Target Site: Void ConstructionCompleteEvent(Boolean)

我有一个简单的编排,其中一个接收端口一个发送端口使用两种模式。我将无界“细节”的记录计数放入名为 nRecordCount 的变量中,并在 MessageLoop 中使用循环计数器来递增放置在表达式末尾的计数以 nLoopCount = nLoopCount + 1; 作为表达式的对象。

Orchestration

第二个架构(名称:SalesOrderDetail_V2_2.xsd)的详细结构与第一个架构(名称:SalesOrderRequest_V2_2.xsd)相同。 xsd),但删除了所有标题标签。

在此处输入图像描述

和下面的 SalesOrderRequest_V2_2.xsd

在此处输入图像描述

看起来像是一个方钉正试图映射到一个圆孔。我尝试对此进行调试,但在 file0.cs 中的以下代码处失败,如下所示;

在此处输入图像描述

我在 Orchestration Debug 中也找不到任何有用的内容。 任何人都可以进一步阐明我在使用 Xpath 时可能缺少的内容吗?

完整的项目已被压缩,可以在以下地址下载

https://skydrive.live.com/redir.aspx?cid=533fd5a521c8c878&resid=533 FD5A521C8C878!1848&parid=533FD5A521C8C878!119&authkey=!AE4gYqCoqmZd8xs

请参阅此链接以获取可能的修复方法。如果我更改架构结构(XSD)文件,我已经设法获得了可行的解决方案。

这是链接: xpath - 如何让方法 B 发挥作用?

Profile: Biztalk 2009 update 4 on Windows 2008 Server SP2 (Development platform)
Hi When using xpath to map my output using a Message Construct and a Message Assignment with the following code:

    sXPath = System.String.Format("/*[local-name()='ProcessSalesOrder' and namespace-uri()='http://www.TestSchemas.net/TestSchemas_V2_2/schemas']/*[local-name()='header' and namespace-uri()='http://www.TestSchemas.net/TestSchemas_V2_2/schemas']/*[local-name()='detail' and namespace-uri()='http://www.TestSchemas.net/TestSchemas_V2_2/schemas' and position()={0}]", nLoopCount);
    System.Diagnostics.Debug.WriteLine(sXPath);
    SingleInput = xpath(Input, sXPath);

I get an Exception in the Event Viewer;

    Exception thrown from: segment 1, progress 15
    Inner exception: The part 'part' of message 'SingleInput' contained a null value at the end of the construct block.

    Exception type: NullPartException
    Source: Microsoft.XLANGs.Engine
    Target Site: Void ConstructionCompleteEvent(Boolean)

I have a simple orchestration with one Receive Port one Send port using two schemas. I get the record count of the unbounded "detail" into a variable called nRecordCount and I am using a loop counter in the MessageLoop to increment this placed at the end in an Expression object with nLoopCount = nLoopCount + 1; as the expression.

Orchestration

The detail structure of the 2nd Schema (Name: SalesOrderDetail_V2_2.xsd) is the same as the 1st (Name: SalesOrderRequest_V2_2.xsd) but all the header tags removed.

enter image description here

and the SalesOrderRequest_V2_2.xsd below

enter image description here

It seems like a Square peg is trying to be mapped to a round hole. I have tried to debug this but fails at the following code in the file0.cs at the point shown below;

enter image description here

I cannot find anything useful in the Orchestration Debug either.
Can anyone shed some further light on what I maybe missing when using Xpath?

The complete project has been zipped and is available to download at the following address

https://skydrive.live.com/redir.aspx?cid=533fd5a521c8c878&resid=533FD5A521C8C878!1848&parid=533FD5A521C8C878!119&authkey=!AE4gYqCoqmZd8xs

Please see this link for a possible fix. I have managed to get a workable solution if I change the Schema Structure (XSD) file.

Here is the link:
xpath - How to get Method B to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放血 2024-12-29 05:56:23

我最近遇到了一个非常相似的场景(从单个输入消息创建一批消息),最终得到了一个略有不同的解决方案:

在循环内,我创建一个简单的计数器消息,分配当前计数器值。

接下来,在构造消息形状中,我有一个映射,它使用计数器消息和原始源消息作为输入消息,并使用批处理消息模式作为输出。

在地图内部,我使用“调用 Xslt 模板”脚本函数,该函数从计数器消息接收计数器值作为 Xslt 参数。我用这个参数来提取所需的源节点,其 XPath 与您基本相同(即position()=$param)。

我知道,由于字段数量巨大,使用 Call Xslt Template 可能不适合您。

我没有准备好 ATM 的 BizTalk 开发环境,但也可以使用“普通”functoid 而不是调用 Xslt 模板来提取序列节点。

I recently had a very similar scenario (creating a batch of messages from a single input message) and ended up with only a slightly different solution:

Inside the loop I create a simple Counter message, assigning the current counter value.

Next inside a Construct Message shape I have a Map which uses the Counter message and the original source message as input messages and the batch message schema as the output.

Inside the Map I use a "Call Xslt Template" Script functiod which receives the counter value from the Counter Message as a Xslt param. This param I use to extract the desired source node with basically the same XPath (i.e. position()=$param) like you do.

I'm aware that using Call Xslt Template may not be an option for you simply due to the huge amount of fields.

I don't have my BizTalk dev environment ready atm but extracting the sequence node should also be possible using "plain" functoids instead of Call Xslt Template.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文