0
votes

So, using Logic Apps with an Integration Account, the output of a Decode X12 action when Preserve Interchange is enabled is something like

<ins0:X12InterchangeXml DelimiterSetSerializedData="13:10:-1:42:60:-1:-1:-1:-1" 
xmlns:ins0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006/InterchangeXML">
<ns0:ISA 
    xmlns:ns0="http://schemas.microsoft.com/Edi/X12ServiceSchema">
    <ISA01>00</ISA01>
    <ISA02></ISA02>
    <ISA03>01</ISA03>
    <ISA04></ISA04>
    <ISA05>ZZ</ISA05>
    <ISA06>123456789      </ISA06>
    <ISA07>12</ISA07>
    <ISA08>9987654321     </ISA08>
    <ISA09>180102</ISA09>
    <ISA10>2108</ISA10>
    <ISA11>U</ISA11>
    <ISA12>00400</ISA12>
    <ISA13>000000351</ISA13>
    <ISA14>0</ISA14>
    <ISA15>P</ISA15>
    <ISA16>&lt;</ISA16>
</ns0:ISA>
<FunctionalGroup DocType="http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_856">
    <ns0:GS 
        xmlns:ns0="http://schemas.microsoft.com/Edi/X12ServiceSchema">
        <GS01>SH</GS01>
        <GS02>123456789</GS02>
        <GS03>9987654321</GS03>
        <GS04>20180102</GS04>
        <GS05>2108</GS05>
        <GS06>351</GS06>
        <GS07>X</GS07>
        <GS08>004010</GS08>
    </ns0:GS>
    <TransactionSet DocType="http://schemas.microsoft.com/BizTalk/EDI/X12/2006#X12_00401_856">
        <ns0:X12_00401_856 
            xmlns:ns0="http://schemas.microsoft.com/BizTalk/EDI/X12/2006">
            <ST>
                <ST01>856</ST01>
                <ST02>000351</ST02>
            </ST>
            <ns0:BSN>
                <BSN01>00</BSN01>
                <BSN02>SID87447</BSN02>
                <BSN03>20180102</BSN03>
                <BSN04>2108</BSN04>
            </ns0:BSN>
            <ns0:DTM>
                <DTM01>011</DTM01>
                <DTM02>20180102</DTM02>
                <DTM03>2109</DTM03>
                <DTM04>ET</DTM04>
            </ns0:DTM>
            <ns0:HLLoop1>
                <ns0:HL>
                    <HL01>1</HL01>
                    <HL03>S</HL03>
                    <HL04>1</HL04>
                </ns0:HL>
                <ns0:MEA>
                    <MEA01>PD</MEA01>
                    <MEA02>G</MEA02>
                    <MEA03>9985</MEA03>
                    <ns0:C001_2>
                        <C00101>LB</C00101>
                    </ns0:C001_2>
                </ns0:MEA>
                <ns0:MEA>
                    <MEA01>PD</MEA01>
                    <MEA02>N</MEA02>
                    <MEA03>9174</MEA03>
                    <ns0:C001_2>
                        <C00101>LB</C00101>
                    </ns0:C001_2>
                </ns0:MEA>
                <ns0:TD1>
                    <TD101>CTN90</TD101>
                    <TD102>55</TD102>
                </ns0:TD1>
                <ns0:TD5>
                    <TD501>B</TD501>
                    <TD502>2</TD502>
                    <TD503>LODQ</TD503>
                    <TD504>M</TD504>
                </ns0:TD5>
                <ns0:TD3>
                    <TD301>TL</TD301>
                    <TD303>1</TD303>
                </ns0:TD3>
                <ns0:REF>
                    <REF01>BM</REF01>
                    <REF02>SID87447</REF02>
                </ns0:REF>
                <ns0:N1Loop1>
                    <ns0:N1>
                        <N101>SU</N101>
                        <N103>92</N103>
                        <N104>8888</N104>
                    </ns0:N1>
                </ns0:N1Loop1>
            </ns0:HLLoop1>
            <ns0:HLLoop1>
                <ns0:HL>
                    <HL01>2</HL01>
                    <HL02>1</HL02>
                    <HL03>O</HL03>
                    <HL04>1</HL04>
                </ns0:HL>
                <ns0:PRF>
                    <PRF01>2018002A</PRF01>
                </ns0:PRF>
                <ns0:REF>
                    <REF01>MH</REF01>
                    <REF02>50945</REF02>
                </ns0:REF>
                <ns0:N1Loop1>
                    <ns0:N1>
                        <N101>SU</N101>
                        <N103>92</N103>
                        <N104>8888</N104>
                    </ns0:N1>
                </ns0:N1Loop1>
            </ns0:HLLoop1>
            <ns0:HLLoop1>
                <ns0:HL>
                    <HL01>3</HL01>
                    <HL02>2</HL02>
                    <HL03>I</HL03>
                    <HL04>0</HL04>
                </ns0:HL>
                <ns0:LIN>
                    <LIN02>BP</LIN02>
                    <LIN03>58706-02010-00V</LIN03>
                    <LIN04>RC</LIN04>
                    <LIN05>S0467</LIN05>
                </ns0:LIN>
                <ns0:SN1>
                    <SN102>1029</SN102>
                    <SN103>EA</SN103>
                </ns0:SN1>
            </ns0:HLLoop1>
            <ns0:HLLoop1>
                <ns0:HL>
                    <HL01>4</HL01>
                    <HL02>2</HL02>
                    <HL03>I</HL03>
                    <HL04>0</HL04>
                </ns0:HL>
                <ns0:LIN>
                    <LIN02>BP</LIN02>
                    <LIN03>61327-0R030-K0V</LIN03>
                    <LIN04>RC</LIN04>
                    <LIN05>B0058</LIN05>
                </ns0:LIN>
                <ns0:SN1>
                    <SN102>858</SN102>
                    <SN103>EA</SN103>
                </ns0:SN1>
            </ns0:HLLoop1>
            <ns0:HLLoop1>
                <ns0:HL>
                    <HL01>5</HL01>
                    <HL02>2</HL02>
                    <HL03>I</HL03>
                    <HL04>0</HL04>
                </ns0:HL>
                <ns0:LIN>
                    <LIN02>BP</LIN02>
                    <LIN03>61328-0R030-K0V</LIN03>
                    <LIN04>RC</LIN04>
                    <LIN05>B0059</LIN05>
                </ns0:LIN>
                <ns0:SN1>
                    <SN102>858</SN102>
                    <SN103>EA</SN103>
                </ns0:SN1>
            </ns0:HLLoop1>
            <ns0:CTT>
                <CTT01>5</CTT01>
            </ns0:CTT>
            <SE>
                <SE01>26</SE01>
                <SE02>000351</SE02>
            </SE>
        </ns0:X12_00401_856>
    </TransactionSet>
    <ns0:GE 
        xmlns:ns0="http://schemas.microsoft.com/Edi/X12ServiceSchema">
        <GE01>1</GE01>
        <GE02>351</GE02>
    </ns0:GE>
</FunctionalGroup>
<ns0:IEA 
    xmlns:ns0="http://schemas.microsoft.com/Edi/X12ServiceSchema">
    <IEA01>1</IEA01>
    <IEA02>000000351</IEA02>
</ns0:IEA>

Does anyone know of a source for an XSD that will validate such a document? I would think MS provides one. Perhaps it is part of an on-premise BizTalk installation, but not available through Azure?

2

2 Answers

0
votes
  1. You should put schemas for different namespaces in different file, declare the namespaces accordingly and use xs:import to import them one into another.
  2. Looks like the tool does not handle namespaces correctly and simply considers xmlns:ns0 to be an attribute. If you've sorted out the namespace problem, you won't need these attributes anymore, feel free to remove.
  3. Sorry, don't understand the question.

Writing XML Schemas is not easy. For an example of a rather large XML Schema repository see OGC Schemas. You'll find a lot of examples there, I'd recommend to start with Filter 2.0.

0
votes

Correct, the X12InterchangeXml (and EDIFACT) instance format is directly lifted from BizTalk Server. You also presume correctly that the schemas for such are included with the BizTalk Server product...only :(. See note below.

However, what do you expect to do with this? There is practically no need to validate it, meaning don't bother, it's just additional complication for no benefit.

I've written about working with Preserve Interchange, BizTalk Server: Working with Preserve Interchange EDI Xml (Part 1). There are tools beyond Visual Studio that can infer a Schema if you really need one.

If you explain what you're trying to do, I can update the Answer with current guidance.

Note: The X12 Schemas were available but there is a licensing snag they're working on.