Biztalk 使用平面文件反汇编程序开发自定义接收管道

Biztalk 使用平面文件反汇编程序开发自定义接收管道,biztalk,biztalk-2010,Biztalk,Biztalk 2010,我有一个.txt文件,格式与下面类似 111515161515950000055 00012913702613000000000003000 139C000007000000 121515165121510000054 000229138036030000000000009000 000279A000009000 1315115950000065516515 00032813104643000000000007000399B000003000 12151511600032900032900000

我有一个.txt文件,格式与下面类似

111515161515950000055 00012913702613000000000003000 139C000007000000
121515165121510000054 000229138036030000000000009000 000279A000009000
1315115950000065516515 00032813104643000000000007000399B000003000
121515116000329000329000000000003000


前3行是主体元素,但主体部分中的行数未知(可能从1到无界)。主体部分中没有标记标识符。文件中的最后一行始终是尾部。在解析之前,将删除文件中的尾部,以便只需要解析记录。如何使用平面文件反汇编程序中的管道组件完成此操作。

您不需要卸下拖车。 您需要它来定义一个平面文件模式,其中Body记录可以无限制地出现,并为trail定义一个单独的记录。 您必须在下面的示例中设置根上的分隔符,子分隔符=0x0D 0x0A(CR LF),子分隔符类型=十六进制,子顺序=中缀,但这可能会有所不同,并且您必须声明正确的分隔符以及发生分隔符的位置。对于上面的文件,我假设拖车后面没有CR LF,因此如果最后一行有CR LF,则选择中缀(分隔符出现在中间)而不是后缀(分隔符出现在后面)

然后,可以将主体和尾部结构定义为分隔或定位

更新:要在要处理的消息中不包含尾部,请在接收端口上设置一个仅映射正文记录而不映射尾部的映射

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch.FlatFile" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch.FlatFile" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:annotation>
    <xs:appinfo>
      <b:schemaInfo standard="Flat File" root_reference="Root" 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="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" />
      <schemaEditorExtension:schemaInfo namespaceAlias="b" extensionClass="Microsoft.BizTalk.FlatFileExtension.FlatFileExtension" standardName="Flat File" xmlns:schemaEditorExtension="http://schemas.microsoft.com/BizTalk/2003/SchemaEditorExtensions" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" sequence_number="1" child_order="infix" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" />
      </xs:appinfo>
    </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:annotation>
          <xs:appinfo>
            <b:groupInfo sequence_number="0" />
          </xs:appinfo>
        </xs:annotation>
        <xs:element maxOccurs="unbounded" name="Body">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="1" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="BodyContents" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo sequence_number="1" justification="left" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="Trailer">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo sequence_number="2" structure="delimited" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </xs:appinfo>
          </xs:annotation>
          <xs:complexType>
            <xs:sequence>
              <xs:annotation>
                <xs:appinfo>
                  <b:groupInfo sequence_number="0" />
                </xs:appinfo>
              </xs:annotation>
              <xs:element name="TrailerContents" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo sequence_number="1" justification="left" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


谢谢。但是如果我必须在没有预告片的情况下发送消息,我该怎么做呢?在你的接收端口中有一个映射,它只复制身体记录,而不是预告片记录。您的目标文件是相同的平面文件格式吗?即使我使用Body作为unbounded,我也只得到一行Body作为输入,其余的行将被忽略,它将占用拖车。我不知道为什么。你能帮忙吗。