简体   繁体   English

将自定义位置平面文件架构从 Seeburger 迁移到 BizTalk 的问题

[英]Issue migrating custom positional flat file schema from Seeburger to BizTalk

I am trying to migrate some positional flat file schemas from Seeburger to BizTalk and it seems I am stuck with a problem I do not know how to handle with BizTalk.我正在尝试将一些位置平面文件架构从 Seeburger 迁移到 BizTalk,似乎我遇到了一个我不知道如何处理 BizTalk 的问题。

I'll try to reduce the complexity to the basic issue I am having.我会尽量减少我遇到的基本问题的复杂性。

Let's say that in Seeburger the following message is processed.假设在 Seeburger 中处理了以下消息。

Field1----Field2-------Field3----Field4--[CR][LF]

I added padding character "-" here to be visible, and CR LF segment terminator我在此处添加了填充字符“-”以使其可见,并且 CR LF 段终止符

The seeburger schema has defined the following structure for the above message seeburger 模式为上述消息定义了以下结构

Field1 = Min/Max length = 10 characters Field1 = 最小/最大长度 = 10 个字符

Field2 = Min/Max length = 13 characters Field2 = 最小/最大长度 = 13 个字符

Field3 = Min/Max length = 10 characters字段 3 = 最小/最大长度 = 10 个字符

Field4 = Min/Max length = 8 characters Field4 = 最小/最大长度 = 8 个字符

All fields are optional so it may be possible to get a message like this only所有字段都是可选的,因此可能只会收到这样的消息

Field1----Field2-------Field3----[CR][LF]

Until here everything works fine.直到这里一切正常。 The problem is that the actual messages received by Seeburger are looking like this for example:问题是 Seeburger 收到的实际消息如下所示:

Field1----Field2-------Field3----Field4[CR][LF]

or或者

Field1----Field2-------Field3[CR][LF]

Please notice that the padding characters are missing from the last element from the record.请注意,记录的最后一个元素中缺少填充字符。 Seeburger knows to handle this but in BizTalk I am not able to validate a message like this. Seeburger 知道要处理这个问题,但在 BizTalk 中我无法验证这样的消息。 ( without last element length < length defined in schema ) (没有最后一个元素长度<模式中定义的长度)

Biztalk expects that the length of last field from the record to be the defined length in the schema which makes sense. Biztalk 期望记录中最后一个字段的长度是模式中定义的长度,这是有意义的。 I did tried a lot of things but I was not able to find a solution for this.我确实尝试了很多东西,但我无法找到解决方案。

Was somebody else stuck on this or do you have any suggestions?其他人是否坚持这一点,或者您有什么建议?

  1. You need to set the Early Termination flag to True on the schema root您需要在架构根上将 Early Termination 标志设置为 True 提前终止标志图像

  2. Set the Early Terminate Optional Fields to Yes将提前终止可选字段设置为是提前终止可选字段

  3. Make sure all the fields that are optional have the Min Occurs set to 0确保所有可选字段的 Min Occurs 设置为 0

For an input file对于输入文件

Field1----Field2-------Field3----Field4--[CR][LF]
Field1----Field2-------Field3----Field4[CR][LF]
Field1----Field2-------Field3[CR][LF]
Field1----Field2-------[CR][LF]
Field1----Field2[CR][LF]
Field1----[CR][LF]
Field1[CR][LF]

The schema架构

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://Scratch2.Schema.SO73820633" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://Scratch2.Schema.SO73820633" 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="false" compile_parse_tables="false" root_reference="Root" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="Root">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" child_delimiter_type="hex" child_delimiter="0x0D 0x0A" child_order="postfix" />
      </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="unbounded" name="Record">
          <xs:annotation>
            <xs:appinfo>
              <recordInfo sequence_number="1" structure="positional" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" xmlns="http://schemas.microsoft.com/BizTalk/2003" />
            </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 minOccurs="0" name="Root_Child1" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Root_Child2" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_offset="0" pos_length="13" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Root_Child3" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_offset="0" pos_length="10" sequence_number="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element minOccurs="0" name="Root_Child4" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" pos_offset="0" pos_length="8" sequence_number="4" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

Will parse it to below (XML tidied with Notepad++ for readability)将其解析到下面(使用 Notepad++ 整理的 XML 以提高可读性)

<Root xmlns="http://Scratch2.Schema.SO73820633">
    <Record xmlns="">
        <Root_Child1>Field1----</Root_Child1>
        <Root_Child2>Field2-------</Root_Child2>
        <Root_Child3>Field3----</Root_Child3>
        <Root_Child4>Field4--</Root_Child4>
    </Record>
    <Record xmlns="">
        <Root_Child1>Field1----</Root_Child1>
        <Root_Child2>Field2-------</Root_Child2>
        <Root_Child3>Field3----</Root_Child3>
        <Root_Child4>Field4</Root_Child4>
    </Record>
    <Record xmlns="">
        <Root_Child1>Field1----</Root_Child1>
        <Root_Child2>Field2-------</Root_Child2>
        <Root_Child3>Field3</Root_Child3>
    </Record>
    <Record xmlns="">
        <Root_Child1>Field1----</Root_Child1>
        <Root_Child2>Field2-------</Root_Child2>
    </Record>
    <Record xmlns="">
        <Root_Child1>Field1----</Root_Child1>
        <Root_Child2>Field2</Root_Child2>
    </Record>
    <Record xmlns="">
        <Root_Child1>Field1----</Root_Child1>
    </Record>
    <Record xmlns="">
        <Root_Child1>Field1</Root_Child1>
    </Record>
</Root>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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