BizTalk FF反汇编程序-仅适用于非常小的文件

时间:2018-09-17 16:26:31

标签: biztalk biztalk-2016

我有一个BizTalk 2016 / VS 2015解决方案。 有一个简单的平面文件架构,通过重复记录元素的“最大出现次数”(Max Occurs)属性设置为0,来分隔每一行。

模式的“配置”部分如下所示:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
      <b:schemaInfo standard="Flat File" codepage="65001" default_pad_char=" " pad_char_type="char" count_positions_by_byte="false" parser_optimization="speed" lookahead_depth="3" suppress_empty_nodes="false" generate_empty_nodes="true" allow_early_termination="true" early_terminate_optional_fields="true" allow_message_breakup_of_infix_root="true" compile_parse_tables="false" root_reference="Employee" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Employee">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xA" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
        <b:properties>
          <b:property distinguished="true" xpath="/*[local-name()='Employee' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='Data' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='NiNumber' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']" />
          <b:property distinguished="true" xpath="/*[local-name()='Employee' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='Data' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='OrgLeaveDate' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']" />
          <b:property distinguished="true" xpath="/*[local-name()='Employee' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='Data' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='PosLeaveDate' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']" />
          <b:property distinguished="true" xpath="/*[local-name()='Employee' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='Data' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']/*[local-name()='PostStartDate' and namespace-uri()='http://LCC.Integration.Employees.Schemas.SAP.SapEmployee_FF']" />
        </b:properties>
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <groupInfo sequence_number="0" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element maxOccurs="1" name="Data">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0x9" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>

输入文件由制表符分隔,并以Unix样式行结尾。

关于平面文件架构的唯一有点不寻常的事情是最后一个元素“ PostStartDate”的micOccurs属性值为0。这是因为这些文档有两个提供程序,而其中一个没有包括“ PostStartDate”列。

我设置了一个包含FF反汇编程序的接收位置。它的DocumentSpecName属性设置为架构的属性。所有其他属性均为默认设置。

此接收的唯一订阅者是发送到本地文件夹的发送端口。

如果我放一个3行的平面文件,那么一切正常。但是,如果我再扩展几行(在本示例中为7行),则BizTalk会在接收位置挂起,并显示错误消息:“消息引擎在处理一个或多个入站消息期间遇到错误。”在事件日志中,我看到错误:

There was a failure executing the receive pipeline: "LCC.Integration.Common.Pipelines.RcvArchiveFF, LCC.Integration.Common.Pipelines, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ff3873c2d0a7e656" Source: "Flat file disassembler" Receive Port: "SharePoint.Employees.Receive.SAPExtract" URI: "D:\FileDrop\Employees\In\*.txt" Reason: Unexpected data found while looking for:
'\t'
The current definition being parsed is Employee. The stream offset where the error occured is 1813. The line number where the error occured is 8. The column where the error occured is 0.

我注意到的另一件事,如果我从文件的最后一行中删除结尾的LF,那么它将起作用-不管行数是多少。

我进行了截屏演示以演示问题:Screencast of Problem

我已经创建了示例解决方案来演示该问题。可在以下github存储库中找到它:https://github.com/RobBowman/BizTalkFFProblem

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

编辑:我刚刚在BizTalk 2013R2中尝试了您的GitHub示例,并且无需更改即可正常运行。

Edit2:> 20行时中断。

Edit3:我现在意识到它实际上不受支持,设置为:“允许 Infix 根目录下的邮件拆分” ...您的模式不是中缀的,它是{{1 }}。仅在postfix时才支持在分解器上分离FlatFiles。如果可能的话,您应该使您的架构支持infix,然后它将起作用。