Re: Problem regarding xml debatching

Home Page Forums BizTalk 2004 – BizTalk 2010 Problem regarding xml debatching Re: Problem regarding xml debatching

#21921

Hi Thanks for the reply  I am receiving a flatfile msg and after doing some mappings I am transforming that flatfile data into XML message and this XML msg has header,Line and Dist and I need to debatch those records into individual messages, like if there are 2 header records in a .txt file i should have 2 xml msgs for the header and for Line if there are 20 Line then i need to get 20 line messages and like wise to the Dist also so I am implementing the debatch mechanism from the Stephens. Thomas article but I am getting this error. 

 my schema is

TEMS_SQL>

<TEMS>
<Header>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_STYLE>REG</VOUCHER_STYLE>
  <INVOICE_ID>404R285738738_08282008</INVOICE_ID>
  <INVOICE_DT>20080828</INVOICE_DT>
  <VENDOR_SETID>SHARE</VENDOR_SETID>
  <VENDOR_ID>00539</VENDOR_ID>
  <VNDR_LOC>HO1</VNDR_LOC>
  <ADDRESS_SEQ_NUM>REG</ADDRESS_SEQ_NUM>
  <ORIGIN>TEM</ORIGIN>
  <OPRID>APBATCH</OPRID>
  <ACCOUNTING_DT>03162009</ACCOUNTING_DT>
  <GROSS_AMT>33566.39</GROSS_AMT>
  <PYMNT_TERMS_CD>IMMED</PYMNT_TERMS_CD>
  </Header>
<SubRecord>
<LINE>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>1</VOUCHER_LINE_NUM>
  <DESCR />
  <MERCHANDISE_AMT>49.82</MERCHANDISE_AMT>
  <WTHD_SW>N</WTHD_SW>
  </LINE>
<LINE>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>2</VOUCHER_LINE_NUM>
  <DESCR />
  <MERCHANDISE_AMT>192.19</MERCHANDISE_AMT>
  <WTHD_SW>N</WTHD_SW>
  </LINE>
<LINE>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>3</VOUCHER_LINE_NUM>
  <DESCR />
  <MERCHANDISE_AMT>602.69</MERCHANDISE_AMT>
  <WTHD_SW>N</WTHD_SW>
  </LINE>
<LINE>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>4</VOUCHER_LINE_NUM>
  <DESCR />
  <MERCHANDISE_AMT>237.68</MERCHANDISE_AMT>
  <WTHD_SW>N</WTHD_SW>
  </LINE>
<Dist>

  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>1</VOUCHER_LINE_NUM>
  <DISTRIB_LINE_NUM>1</DISTRIB_LINE_NUM>
  <BUSINESS_UNIT_GL>SN018</BUSINESS_UNIT_GL>
  <QTY_VCHR>OPTIONAL</QTY_VCHR>
  <MERCHANDISE_AMT>49.82</MERCHANDISE_AMT>
  <PO_DIST_LINE_NUM>OPTIONAL</PO_DIST_LINE_NUM>
  <ACCOUNT>911000</ACCOUNT>
  <DEPTID>9000</DEPTID>
  <CHARTFIELD1>TEM01100</CHARTFIELD1>
  </Dist>
<Dist>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>2</VOUCHER_LINE_NUM>
  <DISTRIB_LINE_NUM>2</DISTRIB_LINE_NUM>
  <BUSINESS_UNIT_GL>SN008</BUSINESS_UNIT_GL>
  <QTY_VCHR>OPTIONAL</QTY_VCHR>
  <MERCHANDISE_AMT>192.19</MERCHANDISE_AMT>
  <PO_DIST_LINE_NUM>OPTIONAL</PO_DIST_LINE_NUM>
  <ACCOUNT>911000</ACCOUNT>
  <DEPTID>9000</DEPTID>
  <CHARTFIELD1>TEM01100</CHARTFIELD1>
  </Dist>
<Dist>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>3</VOUCHER_LINE_NUM>
  <DISTRIB_LINE_NUM>3</DISTRIB_LINE_NUM>
  <BUSINESS_UNIT_GL>SN053</BUSINESS_UNIT_GL>
  <QTY_VCHR>OPTIONAL</QTY_VCHR>
  <MERCHANDISE_AMT>602.69</MERCHANDISE_AMT>
  <PO_DIST_LINE_NUM>OPTIONAL</PO_DIST_LINE_NUM>
  <ACCOUNT>911000</ACCOUNT>
  <DEPTID>9000</DEPTID>
  <CHARTFIELD1>TEM01100</CHARTFIELD1>
  </Dist>
<Dist>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>4</VOUCHER_LINE_NUM>
  <DISTRIB_LINE_NUM>4</DISTRIB_LINE_NUM>
  <BUSINESS_UNIT_GL>SN008</BUSINESS_UNIT_GL>
  <QTY_VCHR>OPTIONAL</QTY_VCHR>
  <MERCHANDISE_AMT>237.68</MERCHANDISE_AMT>
  <PO_DIST_LINE_NUM>OPTIONAL</PO_DIST_LINE_NUM>
  <ACCOUNT>911000</ACCOUNT>
  <DEPTID>9000</DEPTID>
  <CHARTFIELD1>TEM01100</CHARTFIELD1>
  </Dist>
<Dist>
  <BUSINESS_UNIT>SN018</BUSINESS_UNIT>
  <VCHR_BLD_KEY_C1>SN018</VCHR_BLD_KEY_C1>
  <VCHR_BLD_KEY_N1>03162009</VCHR_BLD_KEY_N1>
  <VCHR_BLD_KEY_N2>14:41:28</VCHR_BLD_KEY_N2>
  <VOUCHER_ID>NEXT</VOUCHER_ID>
  <VOUCHER_LINE_NUM>5</VOUCHER_LINE_NUM>
  <DISTRIB_LINE_NUM>5</DISTRIB_LINE_NUM>
  <BUSINESS_UNIT_GL>SN020</BUSINESS_UNIT_GL>
  <QTY_VCHR>OPTIONAL</QTY_VCHR>
  <MERCHANDISE_AMT>1157.64</MERCHANDISE_AMT>
  <PO_DIST_LINE_NUM>OPTIONAL</PO_DIST_LINE_NUM>
  <ACCOUNT>911000</ACCOUNT>
  <DEPTID>9000</DEPTID>
  <CHARTFIELD1>TEM01100</CHARTFIELD1>
  </Dist>
so now I have to debatch Header,line and Dist into single messages
what I am doing in the orchestration is  For Header
Expression shape: 

HeaderCount = System.Convert.ToInt32(xpath(SQLMessage, “count(//Header)”));

in the message assignment shape:

Variable_3 = System.String.Format(“//Header[{0}]”,HeaderInstance);

Message_1 = xpath(SQLMessage, Variable_3);

and I am looping for the multiple header because there a possibility of getting multiple headers in a message.

I am getting an error in the construct message shape which says:

Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘TEMSInt.TemsOrchestration(10e74d9f-953f-b28d-425d-5fdbee10e5c7)’.
The service instance will remain suspended until administratively resumed or terminated.
If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.
InstanceId: aca1d817-96c0-4154-be0b-10e065b2ebf4
Shape name: Header
ShapeId: 83aa2bc8-71b9-412f-8e4a-178c40697408
Exception thrown from: segment 1, progress 32
Inner exception: Specified method is not supported.
       
Exception type: NotSupportedException
Source: Microsoft.XLANGs.Engine
Target Site: Microsoft.XLANGs.Core.Value GenericLoadFrom(System.Object)
The following is a stack trace that identifies the location where the exception occured

   at Microsoft.XLANGs.Core.Part.GenericLoadFrom(Object source)
   at Microsoft.XLANGs.Core.XSDPart.ProtectedLoadFrom(Object source)
   at Microsoft.XLANGs.Core.Part.LoadFrom(Object source)
 

can you please help me to solve this error.

 

Thanks