如何使用BizTalk创建包含查询中的标题和行的平面文件?

时间:2012-05-22 07:48:19

标签: biztalk biztalk-2010

我是BizTalk的新手,我正在设法从Oracle创建普通的接口到平面文件。

但是我们的大多数接口都是一个标题与不同长度的行的组合。

例如,查询将是......

select oh.id, oh.name, ol.lineNo, ol.qty_ordered, ol.qty_shipped, ol.price 
from header oh, line ol

这会产生类似于此的平面文件......

oh.id       |  oh.name
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
oh.id       |  oh.name
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price
ol.lineNo   |  ol.qty_ordered  |  ol.qty_shipped  |  ol.price

我确信这不是BizTalk的奇怪设置,但我不知道如何调用它,所以我不能真正谷歌它。到目前为止,我似乎在创建一个架构和映射时遇到问题,这将允许这些行不同

2 个答案:

答案 0 :(得分:1)

我建议使用BizTalk架构向导msdn

注意:我只对BizTalk和平面文件做了一些工作,但我发现codeproject上的文章可用作启动器

答案 1 :(得分:1)

如果我正确理解你(我假设你需要一个用于映射器的模式),你需要一个类似于

的模式
     <?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://BizTalk_Server_Project1.FlatFileSchema1" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://BizTalk_Server_Project1.FlatFileSchema1" 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="false" early_terminate_optional_fields="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="Sales" wrap_char_type="char" default_wrap_char="&quot;" />
    </xs:appinfo>
  </xs:annotation>
<xs:element name="orders">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="unbounded" name="order">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="orderheader">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="ohID"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohName"/>
        </xs:sequence>
        </xs:complexType>
    </xs:element>
        <xs:element maxOccurs="1" minOccurs="1" name="orders">
        <xs:complexType>
        <xs:sequence>
        <xs:element maxOccurs="1" minOccurs="1" name="ohLineNo"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohQuantityOrdered"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohQuantityShipped"/>
        <xs:element maxOccurs="1" minOccurs="1" name="ohPrice"/>
        </xs:sequence>
        </xs:complexType>
    </xs:element>
        </xs:sequence>
        </xs:complexType>
        </xs:element>
        </xs:sequence>
        </xs:complexType>
        </xs:element></xs:schema>

然后根据您的结果使用mapper构建?