none
How to convert Following EDI data to XML? RRS feed

  • Question

  •  

    Hi all,

     

    i am trying to convet the EDI document in the XML.

    my output XML seems like this......

     

        <?xml version="1.0" encoding="utf-8" ?>
    - <ns0:Efact_Contrl_Root IsGeneratedAck="true" IsContrlReceipt="true" xmlns:ns0="
    http://schemas.microsoft.com/Edi/Edifact">
    - <ns1:UNH xmlns:ns1="
    http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNH1>P158S</UNH1>
    - <UNH2>
      <UNH2.1>CONTRL</UNH2.1>
      <UNH2.2>4</UNH2.2>
      <UNH2.3>1</UNH2.3>
      <UNH2.4>UN</UNH2.4>
      </UNH2>
      </ns1:UNH>
    - <UCI>
      <UCI1>00000000000001</UCI1>
    - <UCI2>
      <UCI2.1>8713432000006</UCI2.1>
      <UCI2.2>14</UCI2.2>
      </UCI2>
    - <UCI3>
      <UCI3.1>3013558310009</UCI3.1>
      <UCI3.2>14</UCI3.2>
      </UCI3>
      <UCI4>4</UCI4>
      <UCI5>29</UCI5>
      <UCI6>UNT</UCI6>
      </UCI>
    - <ns2:UNT xmlns:ns2="
    http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNT1>3</UNT1>
      <UNT2>P158S</UNT2>
      </ns2:UNT>
      </ns0:Efact_Contrl_Root>
     
     
    and my input edi is like this
    UNA:+.? '
    UNB+UNOC:3+3013558310009:14+8713432000006:14+060914:0721+00000000000001++ORDERS++++1'
    UNH+00000000000001+ORDERS:97A:UN'
    BGM+220+4500149097+9'
    DTM+137:20070726:102'
    DTM+2:20070727:102'
    RFF+ON:4500149097'
    NAD+BY+3013558310009::9'
    NAD+DP+8713432000006::9'
    NAD+IV+3013558310009::9'
    NAD+SU+8901124000018::9'
    CUX+2:EUR:4'
    LIN+1++4901780697809:EN'
    QTY+21:10000CE'
    LIN+2++4901780791255:EN'
    QTY+21:10000CE'
    LIN+3++4901780883264:EN'
    QTY+21:10000CE'
    LIN+4++4901780728619:EN'
    QTY+21:10002CE'
    LIN+5++4901780627363:EN'
    QTY+21:10000CE'
    LIN+6++4901780697809:EN'
    QTY+21:10000CE'
    LIN+7++4901780791255:EN'
    QTY+21:10000CE'
    UNS+S'
    UNT+26+00000000000001'
    UNZ+1+00000000000001'
     
    as u can see i am not able to get the full data
     
    so,please let me know the work around so that i can get the full data...
    1>
    i am using a out of box schema for orders
    2>
    i created a custom pipeline
    3>
    everything deployed properly
     
    but data is not complete
     
    please help me out of this
     
     
    Thanks
     



    ramjeet
    Wednesday, March 26, 2008 7:27 AM

Answers

  • The attached instance had a few errors that was causing it to fail. I have fixed them and tested it on my box. It work. Just use this instance and see if you can get the required XML. We can go on from there.

     

    UNA:+.? '
    UNB+UNOA:1+3013558310009+8901124000018+080404:1341+1'
    UNH+1+ORDERSBig Smile:96A:UN'
    BGM+220+4500169235+9'
    DTM+137:20080321:102'
    DTM+2:20080505:102'
    RFF+ON:4500169235'
    NAD+BY+3013558310009::9'
    NAD+SU+8901124000018::9'
    NAD+DP+8713432000006::9'
    CUX+2:USD:4'
    LIN+1++4905524318258:EN'
    QTY+21:3000'
    LIN+2++4905524318296:EN'
    QTY+21:2508'
    UNS+S'
    UNT+15+1'
    UNZ+1+1'

    Thanks

    Mohsin Kalam

    www.mohsink.com - Blog about Microsoft BizTalk R2 EDI

     

    Wednesday, June 25, 2008 10:04 PM
  •  

    Mohsin,

    i appreciate you for your valuable time and suggestions.....

    it really worked for me and by your help i get all segments data to the XML and from there i have to send it to the DB .but thats the later part.

    once again i thank you for your concern in my case and giving me regular updates.

     

    Thanks

     

    Ramjeet 

    Thursday, June 26, 2008 6:13 AM

All replies

  • This is by design. You probably have the option to split an interchange into transaction sets set in a party, or you are using the global settings.

     

    The way to get all the envelope information is to use a party to resolve this document to and use the "Preserve Interchange" option under "Party as Interchange Sender/Ack Validation and Generation Setting"

     

    To read more about engine receive, you can go to the following link

     

    http://mohsinkalam.wordpress.com/2007/10/02/r2-engine-receive/

     

    Thanks

    Mohsin Kalam

    www.mohsink.com - Blog about Microsoft BizTalk R2 EDI

    Wednesday, March 26, 2008 7:04 PM
  • Hi Mohsin,

    i am again here and my problem is still there,as i am not able to get the whole enveloped data as there in BGN,NAD,QTY etc

    i have tried to do all the setting under the party as interchange sender /Ack validation and generation setting

    i am waiting for your answer

    Thanks in Advance
    Wednesday, June 18, 2008 4:45 AM
  • You XML output is that of a CONTRL ack. This is generated based of the settings in party or the setting in document itself. I assume you are trying to convert the input edi file to XML? If so, I suspect the document is getting suspended before getting persisted to the MsgBox DB. Check the event viewer to see the errors you are seeing. If you could post those errors here, I would be able to help you out better.

     

    Thanks

    Mohsin Kalam

    www.mohsink.com - Blog about Microsoft BizTalk R2 EDI

    Wednesday, June 18, 2008 6:25 PM
  • Hi Mohsin,

    i am using the schema that are in the archieve file and i have already picked up the schema for d96a orders document and implemented the same schema but where i stuck is :
    i am not able to get the data in the NAD,QTY,BGM etc segments.
    i have already tried configuring the pipeline and i tried to change the settings to the schema as well but that too do not materialize.
    i am really kind of stuck to that place only and i need your help desperately.
    i visited the your blogs as well but do not find the way to get the data that is in the edifact document.

    i really appreciate your favour if you provide me with the link or any kind of resource to get the data in the sub segments of the d96a document.

    as far as the errors are concerned there is no error for the transmission of the edifact document to xml, and i do realise that the xml generated is just a kind of acknowledgement ony as it do not contain any valid data.

     

    i apprecaite your favour if you go through the case and give me the appropriate answers

    i am ready to start from the scratch,and waiting for your reply

    plz forward me the specific steps to generate the xml from the edifact document.
    my work requires that,waiting for your reply.....
    Thanks in advance

    Thursday, June 19, 2008 5:15 AM
  • Hi mohsin,

    as you are asking for the error in the event viewer,

     

    Error encountered during parsing. The Edifact interchange with id '1 ', with sender id '3013558310009', receiver id '8901124000018' had the following errors:

    Error: 1 (Field level error)

    SegmentID: UNB

    Position in TS: 1

    Data Element ID: UNB5

    Position in Segment: 5

    Data Value: 1

    37: Invalid character(s) found in data element

     

    and i am attaching the edifact document for this error for your reference alongwith the generated xml

     

    UNA:+.? '
    UNB+UNOA:1+3013558310009+8901124000018+080404:1341+1 '
    UNH+1+ORDERSBig Smile:96A:UN '
    BGM+220+4500169235+9 '
    DTM+137:20080321:102 '
    DTM+2:20080505:102 '
    RFF+ON:4500169235 '
    NAD+BY+3013558310009::9 '
    NAD+SU+ 8901124000018::9 '
    NAD+DP+8713432000006::9 '
    CUX+2:USD:4 '
    LIN+1++4905524318258:EN '
    QTY+21:3000Stick out tongueCE '
    LIN+2++4905524318296:EN '
    QTY+21:2508Stick out tongueCE '
    UNS+S '
    UNT+15+1 '
    UNZ+1+1 '

     

    and the generated xml is as follows

    - <ns0:Efact_Contrl_Root IsGeneratedAck="true" IsContrlReceipt="true" xmlns:ns0="http://schemas.microsoft.com/Edi/Edifact">
    - <ns1:UNH xmlns:ns1="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNH1>11</UNH1>
    - <UNH2>
      <UNH2.1>CONTRL</UNH2.1>
      <UNH2.2>4</UNH2.2>
      <UNH2.3>1</UNH2.3>
      <UNH2.4>UN</UNH2.4>
      </UNH2>
      </ns1:UNH>
    - <UCI>
      <UCI1>1</UCI1>
    - <UCI2>
      <UCI2.1>8901124000018</UCI2.1>
      </UCI2>
    - <UCI3>
      <UCI3.1>3013558310009</UCI3.1>
      </UCI3>
      <UCI4>4</UCI4>
      <UCI5>37</UCI5>
      <UCI6>UNB</UCI6>
    - <UCI7>
      <UCI7.1>5</UCI7.1>
      <UCI7.2>-1</UCI7.2>
      <UCI7.3>1</UCI7.3>
      </UCI7>
      </UCI>
    - <ns2:UNT xmlns:ns2="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNT1>3</UNT1>
      <UNT2>11</UNT2>
      </ns2:UNT>
      </ns0:Efact_Contrl_Root>

    please help me out of this

     

    waiting for your reply

    Thanks

    Thursday, June 19, 2008 9:39 AM
  • Your input message has a space between the last data element and the segment terminator of every segment. I am copy pasting the data that fixes this issue. Please try it out and let me know

     

    UNA:+.? '
    UNB+UNOA:1+3013558310009+8901124000018+080404:1341+1'
    UNH+1+ORDERS:96A:UN'
    BGM+220+4500169235+9'
    DTM+137:20080321:102'
    DTM+2:20080505:102'
    RFF+ON:4500169235'
    NAD+BY+3013558310009::9'
    NAD+SU+ 8901124000018::9'
    NAD+DP+8713432000006::9'
    CUX+2:USD:4'
    LIN+1++4905524318258:EN'
    QTY+21:3000CE'
    LIN+2++4905524318296:EN'
    QTY+21:2508CE'
    UNS+S'
    UNT+15+1'
    UNZ+1+1'

    Thanks

    Mohsin Kalam

    www.mohsink.com - Blog about Microsoft BizTalk R2 EDI

     

    Tuesday, June 24, 2008 9:09 PM
  • Hi Mohsin,
    thanks for taking your valuable time for looking into the case'i really appreciate that

    i have tried doing the things again.
    >created a receive pieline as per your blogs on wordpress.
    >added a schema from the schema under EDI (d96a orders)
    >deployed the solution
    >created the receive port with the receive location and provided the pipeline which i added to the project
    >created the send port and also assign the folder for that as well
    >provide reference to the BIZTALK EDI APPLICATION
    >i have not touched the global edi settings
    >nor i created any party,i got two xml files and my output xml looks like this.....

    first one

    - <ns0:Efact_Contrl_Root IsGeneratedAck="true" xmlns:ns0="http://schemas.microsoft.com/Edi/Edifact">
    - <ns1:UNH xmlns:ns1="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNH1>125</UNH1>
    - <UNH2>
      <UNH2.1>CONTRL</UNH2.1>
      <UNH2.2>4</UNH2.2>
      <UNH2.3>1</UNH2.3>
      <UNH2.4>UN</UNH2.4>
      </UNH2>
      </ns1:UNH>
    - <UCI>
      <UCI1>1</UCI1>
    - <UCI2>
      <UCI2.1>8901124000018</UCI2.1>
      </UCI2>
    - <UCI3>
      <UCI3.1>3013558310009</UCI3.1>
      </UCI3>
      <UCI4>4</UCI4>
      <UCI5>4</UCI5>
      </UCI>
    - <SG1Loop>
    - <ns0:UCM>
      <UCM1>1</UCM1>
    - <UCM2>
      <UCM2.1>ORDERS</UCM2.1>
      <UCM2.2>D</UCM2.2>
      <UCM2.3>96A</UCM2.3>
      <UCM2.4>UN</UCM2.4>
      </UCM2>
      <UCM3>4</UCM3>
      <UCM4>37</UCM4>
      <UCM5>QTY</UCM5>
    - <UCM6>
      <UCM6.1>2</UCM6.1>
      <UCM6.2>2</UCM6.2>
      <UCM6.3>1</UCM6.3>
      </UCM6>
      </ns0:UCM>
    - <SG2Loop>
    - <ns0:UCS>
      <UCS1>11</UCS1>
      <UCS2>37</UCS2>
      </ns0:UCS>
    - <ns0:UCD>
      <UCD1>37</UCD1>
    - <UCD2>
      <UCD2.1>2</UCD2.1>
      <UCD2.2>2</UCD2.2>
      <UCD2.3>1</UCD2.3>
      </UCD2>
      </ns0:UCD>
      </SG2Loop>
    - <SG2Loop>
    - <ns0:UCS>
      <UCS1>13</UCS1>
      <UCS2>37</UCS2>
      </ns0:UCS>
    - <ns0:UCD>
      <UCD1>37</UCD1>
    - <UCD2>
      <UCD2.1>2</UCD2.1>
      <UCD2.2>2</UCD2.2>
      <UCD2.3>1</UCD2.3>
      </UCD2>
      </ns0:UCD>
      </SG2Loop>
      </SG1Loop>
    - <ns2:UNT xmlns:ns2="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNT1>8</UNT1>
      <UNT2>125</UNT2>
      </ns2:UNT>
      </ns0:Efact_Contrl_Root>

    Second one:
    - <ns0:Efact_Contrl_Root IsGeneratedAck="true" IsContrlReceipt="true" xmlns:ns0="http://schemas.microsoft.com/Edi/Edifact">
    - <ns1:UNH xmlns:ns1="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNH1>126</UNH1>
    - <UNH2>
      <UNH2.1>CONTRL</UNH2.1>
      <UNH2.2>4</UNH2.2>
      <UNH2.3>1</UNH2.3>
      <UNH2.4>UN</UNH2.4>
      </UNH2>
      </ns1:UNH>
    - <UCI>
      <UCI1>1</UCI1>
    - <UCI2>
      <UCI2.1>8901124000018</UCI2.1>
      </UCI2>
    - <UCI3>
      <UCI3.1>3013558310009</UCI3.1>
      </UCI3>
      <UCI4>4</UCI4>
      <UCI5>4</UCI5>
      </UCI>
    - <ns2:UNT xmlns:ns2="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
      <UNT1>3</UNT1>
      <UNT2>126</UNT2>
      </ns2:UNT>
      </ns0:Efact_Contrl_Root>


    This time i get few more fields but i am not able to see any data from the d96a input edifact document.

    and well there is an error as well ieSurprisebject is open

    ERROR :

    A message received by adapter "FILE" on receive location "Receive Location3" with URI "E:\PROJECTS\CURRENT PROJECTS\Moser Baer\mohsin\in\*.txt" is suspended.
     Error details: An output message of the component "Microsoft OLE DB Provider for SQL Server" in receive pipeline "mohsin.ReceivePipeline1, mohsin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b1c112d44519540b" is suspended due to the following error:
         Object was open..
     The sequence number of the suspended message is 1. 
     MessageId:  {2AB9E637-3392-4BE1-9ACF-203E26016DFB}
     InstanceID: {44D8954B-5790-46BF-84C8-C88730A1911C}

    so as per you i am sending whole detail to you.

    Thanks and Regards

    Ramjeet

    Wednesday, June 25, 2008 5:42 AM
  • The attached instance had a few errors that was causing it to fail. I have fixed them and tested it on my box. It work. Just use this instance and see if you can get the required XML. We can go on from there.

     

    UNA:+.? '
    UNB+UNOA:1+3013558310009+8901124000018+080404:1341+1'
    UNH+1+ORDERSBig Smile:96A:UN'
    BGM+220+4500169235+9'
    DTM+137:20080321:102'
    DTM+2:20080505:102'
    RFF+ON:4500169235'
    NAD+BY+3013558310009::9'
    NAD+SU+8901124000018::9'
    NAD+DP+8713432000006::9'
    CUX+2:USD:4'
    LIN+1++4905524318258:EN'
    QTY+21:3000'
    LIN+2++4905524318296:EN'
    QTY+21:2508'
    UNS+S'
    UNT+15+1'
    UNZ+1+1'

    Thanks

    Mohsin Kalam

    www.mohsink.com - Blog about Microsoft BizTalk R2 EDI

     

    Wednesday, June 25, 2008 10:04 PM
  •  

    Mohsin,

    i appreciate you for your valuable time and suggestions.....

    it really worked for me and by your help i get all segments data to the XML and from there i have to send it to the DB .but thats the later part.

    once again i thank you for your concern in my case and giving me regular updates.

     

    Thanks

     

    Ramjeet 

    Thursday, June 26, 2008 6:13 AM
  • Hi Ramjeet,

    I am having the same problem as you: the surprose "Object was open". Did you found the solution to the problem?

    Thanks in advance

    BFC
    Thursday, July 2, 2009 10:53 AM