BizTalk仅从CSV文件导入一行

时间:2015-12-07 16:36:14

标签: biztalk biztalk-2013r2

我的BizTalk业务流程只导入一行。

我无法弄清楚出了什么问题,因为没有错误消息或警告。

我正在使用:

  • WCF
  • 编排
  • 接收管道
  • 存储过程
  • CSV平面文件

我认为问题出在csv架构中。

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns="http://ElecFFILEImport.FFILECSVSchema" xmlns:b="http://schemas.microsoft.com/BizTalk/2003" targetNamespace="http://ElecFFILEImport.FFILECSVSchema" 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="false" allow_message_breakup_of_infix_root="false" compile_parse_tables="false" root_reference="FFILERoot" />
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="FFILERoot">
    <xs:annotation>
      <xs:appinfo>
        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="postfix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
      </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 name="Header">
          <xs:annotation>
            <xs:appinfo>
        <b:recordInfo structure="delimited" child_delimiter_type="hex" child_delimiter="0xD 0xA" child_order="infix" sequence_number="1" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </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 name="Header_Row" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element maxOccurs="unbounded" name="Detail">
          <xs:annotation>
            <xs:appinfo>
              <b:recordInfo structure="delimited" child_delimiter_type="char" child_delimiter="," child_order="infix" sequence_number="2" preserve_delimiter_for_empty_data="true" suppress_trailing_delimiters="false" />
            </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 name="FFILECompany" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="1" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="AccountName" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="2" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="HomeAddress" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="3" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="AccountNumber" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="4" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="ServiceNumber" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="5" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="BNumber" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="6" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="DS" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="7" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="LPC" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="8" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="RDate" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="9" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="PDate" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="10" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="BOption" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="11" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="RSCode" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="12" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="CPAssigment" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="13" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
              <xs:element name="Status" type="xs:string">
                <xs:annotation>
                  <xs:appinfo>
                    <b:fieldInfo justification="left" sequence_number="14" />
                  </xs:appinfo>
                </xs:annotation>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

但以防万一这是一个示例文件(假数据)

FFILECompany,Account Name,Home Address,Account Number,Service Number,Bill Number,Delivery Service,LPC,RDate,PDate,BOption,RSCode,CPAssignment,Status
Company A,NORM W MYERS,0 X   WEST STREET STRONGHURST IL 61480,6996293052,439998937,5,DS1,DSHDHD-HP,2014-01-02,,BILL,,,ACTIVE
Company B,ROSABEL BLESKIN,982001 RUSTIC ST ROBINSON IL 62466,1499936152,53875283,13,DS1,RDDD-HP,2014-10-10,,BILL,,,ACTIVE
Company C,TIEE E DISNEY,140505 BEL AIRE DR BELLEVILLE IL 62299,1058999074,40564211,10,DS1,RESSS-HP,2015-01-11,2015-11-09,BILL,,,PENDING INACTIVE
Company D,STEVE BROWN,1044920 COLLEGE AVE ALTON IL 62154,1048999118,54999928,2,DS1,RSS-HP,2014-06-26,,BILL,,,ACTIVE

最后,这是我的存储过程: 如您所见,我只导入了几列:

CREATE PROCEDURE [dbo].[AccountImport]
    @Commodity NVARCHAR(255) , -- Hard Coded value inside the map
    @LDCCode NVARCHAR(2) , -- Hard Coded value inside the map
    @AccountNumber NVARCHAR(255) ,
    @AccountName NVARCHAR(255) ,
    @HomeAddress NVARCHAR(255)
AS 
    INSERT  INTO dbo.[CustomerTable]
            ( Commodity ,
              LDCCode ,
              AccountNumber ,
              AccountName ,
              HomeAddress
            )
            SELECT  @Commodity ,
                    @LDCCode ,
                    @AccountNumber ,
                    @AccountName ,
                    @HomeAddress
DECLARE @MID AS INT
SELECT @MID = @@IDENTITY                    


--This stored procedure will parse the address and separate Address city and state using a space
EXEC    [sync].[ParseAddress]   @ID = @MID

同样,没有错误,每次都会导入一行(第一行)。

enter image description here

3 个答案:

答案 0 :(得分:1)

确保将架构设置为信封架构,以满足多个记录的需要。请参阅以下链接 https://msdn.microsoft.com/en-us/library/aa546772.aspx http://www.codeproject.com/Articles/507336/Envelope-Schema-and-Debatching

答案 1 :(得分:0)

输入业务流程的消息是什么样的?如果只有一行,则问题出在接收管道中;解决方案:

我认为您应该定义两个单独的模式,一个用于文件的头,另一个用于csv文件的主体。像这样填充inf平面文件反汇编程序管道:

DocumentSchema:BodySchemaName,AssemblyName

HeaderSchema:HeaderName,AssemblyName

如果业务流程中的消息已满,没有标题,只有正文,则问题出在映射中,因此您应该向我们提供更多信息。您映射到的架构是什么样的?

答案 2 :(得分:0)

确保入站模式的记录节点上的“最大发生”属性设置为“无界”