Azure 逻辑应用程序 "Encode to Edifact" 要求正文将 UNA 或 UNB 作为第一段

Azure Logic Apps "Encode to Edifact" require body to have UNA or UNB as the first segment

我们正在尝试构建一个新的 EDI 解决方案,我们在其中利用通过 Azure 中的逻辑应用程序和集成帐户提供的各种操作。

我们已经成功地让解码部分与各种 EDIFACT 类型、配置文件和协议一起工作。 但是,当 creating/encoding 一条 EDIFACT 消息时,我们 运行 遇到了麻烦。

编码操作(Encode_to_edifact_message_by_identifies 和 Encode_to_edifact_message_by_agreement_name_v2)似乎需要 UNA 或 UNB 段作为输入数据的一部分。

尝试编码时出现错误消息

{
  "errorMessage": "Edifact interchange should have contained UNA or UNB as the first segment. Instead TransactionSetGroup was found",
  "statusCode": "BadRequest",
  "ReceiverIdentifier": "96",
  "receiverQualifier": "ZZ",
  "SenderIdentifier": "99",
  "senderQualifier": "ZZ"
}

但是,这听起来很奇怪,因为这是在发送设置下的协议中配置的。

协议中的“framingSettings”元素包含所有 UNA 信息以及一些 UNB 信息(版本等),配置文件构成 sender/receiver 部分。

在创建 Xml 内容时,我们不需要关心协议中的内容 - 这就是协议背后的全部思想 ;)

根据ms documentation,UNA 信息(分隔符、指示符等)应从协议中读取。

设置

提供所有样本(简介、协议、测试数据等)有点太多了,但希望有人能分享一些有价值的见解=)

此致, 米凯尔

要编码的示例消息

<ins0:EdifactInterchangeXml DelimiterSetSerializedData="39:13:10:43:58:63:-1:46:-1"
    xmlns:ins0="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006/InterchangeXML">
    <TransactionSetGroup>
        <TransactionSet DocType="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006#EFACT_D97A_DELFOR">
            <ns0:EFACT_D97A_DELFOR xmlns:ns0="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006">
                <UNH>
                    <UNH1>1</UNH1>
                    <UNH2>
                        <UNH2.1>DELFOR</UNH2.1>
                        <UNH2.2>D</UNH2.2>
                        <UNH2.3>97A</UNH2.3>
                        <UNH2.4>UN</UNH2.4>
                    </UNH2>
                </UNH>
                <ns0:BGM>
                    <ns0:C002>
                        <C00201>241</C00201>
                    </ns0:C002>
                    <ns0:C106>
                        <C10601>20170501</C10601>
                    </ns0:C106>
                    <BGM03>5</BGM03>
                </ns0:BGM>
                <ns0:DTM>
                    <ns0:C507>
                        <C50701>137</C50701>
                        <C50702>20170501</C50702>
                        <C50703>102</C50703>
                    </ns0:C507>
                </ns0:DTM>
                <ns0:DTM>
                    <ns0:C507>
                        <C50701>158</C50701>
                        <C50702>20170501</C50702>
                        <C50703>102</C50703>
                    </ns0:C507>
                </ns0:DTM>
                <ns0:DTM>
                    <ns0:C507>
                        <C50701>159</C50701>
                        <C50702>20171231</C50702>
                        <C50703>102</C50703>
                    </ns0:C507>
                </ns0:DTM>
                <ns0:NADLoop1>
                    <ns0:NAD>
                        <NAD01>SU</NAD01>
                        <ns0:C082>
                            <C08201>123456</C08201>
                            <C08203>92</C08203>
                        </ns0:C082>
                        <ns0:C080>
                            <C08001>TEST SUPPLIER</C08001>
                        </ns0:C080>
                    </ns0:NAD>
                </ns0:NADLoop1>
                <ns0:GISLoop1>
                    <ns0:GIS>
                        <ns0:C529>
                            <C52901>36</C52901>
                        </ns0:C529>
                    </ns0:GIS>
                    <ns0:NADLoop2>
                        <ns0:NAD_2>
                            <NAD01>ST</NAD01>
                            <ns0:C082_2>
                                <C08201>123456789</C08201>
                                <C08203>16</C08203>
                            </ns0:C082_2>
                            <ns0:C080_2>
                                <C08001>TEST SHIP-TO PLANT</C08001>
                            </ns0:C080_2>
                            <ns0:C059_2>
                                <C05901>STREET 1</C05901>
                                <C05902>STREET 2</C05902>
                                <C05903>STREET3</C05903>
                            </ns0:C059_2>
                            <NAD06>CITYNAME</NAD06>
                            <NAD07>STATE</NAD07>
                            <NAD08>ZIP CODE</NAD08>
                            <NAD09>USA</NAD09>
                        </ns0:NAD_2>
                    </ns0:NADLoop2>
                    <ns0:LINLoop1>
                        <ns0:LIN>
                            <LIN01>1</LIN01>
                            <ns0:C212>
                                <C21201>PART NUMBER 1</C21201>
                                <C21202>IN</C21202>
                            </ns0:C212>
                        </ns0:LIN>
                        <ns0:IMD>
                            <IMD01>F</IMD01>
                            <ns0:C273>
                                <C27304>ITEM DESCRIPTION</C27304>
                            </ns0:C273>
                        </ns0:IMD>
                        <ns0:LOC_2>
                            <LOC01>7</LOC01>
                            <ns0:C517_2>
                                <C51701>123</C51701>
                            </ns0:C517_2>
                        </ns0:LOC_2>
                        <ns0:RFFLoop4>
                            <ns0:RFF_4>
                                <ns0:C506_4>
                                    <C50601>ON</C50601>
                                    <C50602>9999999</C50602>
                                </ns0:C506_4>
                            </ns0:RFF_4>
                        </ns0:RFFLoop4>
                        <ns0:QTYLoop1>
                            <ns0:QTY>
                                <ns0:C186>
                                    <C18601>48</C18601>
                                    <C18602>4000</C18602>
                                    <C18603>EA</C18603>
                                </ns0:C186>
                            </ns0:QTY>
                            <ns0:DTM_11>
                                <ns0:C507_11>
                                    <C50701>50</C50701>
                                    <C50702>20170101</C50702>
                                    <C50703>102</C50703>
                                </ns0:C507_11>
                            </ns0:DTM_11>
                            <ns0:RFFLoop5>
                                <ns0:RFF_5>
                                    <ns0:C506_5>
                                        <C50601>SI</C50601>
                                        <C50602>22222222</C50602>
                                    </ns0:C506_5>
                                </ns0:RFF_5>
                            </ns0:RFFLoop5>
                        </ns0:QTYLoop1>
                        <ns0:QTYLoop1>
                            <ns0:QTY>
                                <ns0:C186>
                                    <C18601>3</C18601>
                                    <C18602>8000</C18602>
                                    <C18603>EA</C18603>
                                </ns0:C186>
                            </ns0:QTY>
                            <ns0:DTM_11>
                                <ns0:C507_11>
                                    <C50701>51</C50701>
                                    <C50702>20170101</C50702>
                                    <C50703>102</C50703>
                                </ns0:C507_11>
                            </ns0:DTM_11>
                            <ns0:DTM_11>
                                <ns0:C507_11>
                                    <C50701>52</C50701>
                                    <C50702>20170501</C50702>
                                    <C50703>102</C50703>
                                </ns0:C507_11>
                            </ns0:DTM_11>
                        </ns0:QTYLoop1>
                        <ns0:SCCLoop1>
                            <ns0:SCC>
                                <SCC01>10</SCC01>
                                <ns0:C329>
                                    <C32901>D</C32901>
                                </ns0:C329>
                            </ns0:SCC>
                            <ns0:QTYLoop2>
                                <ns0:QTY_2>
                                    <ns0:C186_2>
                                        <C18601>1</C18601>
                                        <C18602>1000</C18602>
                                    </ns0:C186_2>
                                </ns0:QTY_2>
                                <ns0:DTM_13>
                                    <ns0:C507_13>
                                        <C50701>2</C50701>
                                        <C50702>20170501</C50702>
                                        <C50703>102</C50703>
                                    </ns0:C507_13>
                                </ns0:DTM_13>
                            </ns0:QTYLoop2>
                        </ns0:SCCLoop1>
                        <ns0:SCCLoop1>
                            <ns0:SCC>
                                <SCC01>1</SCC01>
                                <ns0:C329>
                                    <C32901>D</C32901>
                                </ns0:C329>
                            </ns0:SCC>
                            <ns0:QTYLoop2>
                                <ns0:QTY_2>
                                    <ns0:C186_2>
                                        <C18601>1</C18601>
                                        <C18602>2000</C18602>
                                    </ns0:C186_2>
                                </ns0:QTY_2>
                                <ns0:DTM_13>
                                    <ns0:C507_13>
                                        <C50701>2</C50701>
                                        <C50702>20170510</C50702>
                                        <C50703>102</C50703>
                                    </ns0:C507_13>
                                </ns0:DTM_13>
                                <ns0:RFFLoop6>
                                    <ns0:RFF_6>
                                        <ns0:C506_6>
                                            <C50601>RE</C50601>
                                            <C50602>111</C50602>
                                        </ns0:C506_6>
                                    </ns0:RFF_6>
                                </ns0:RFFLoop6>
                            </ns0:QTYLoop2>
                            <ns0:QTYLoop2>
                                <ns0:QTY_2>
                                    <ns0:C186_2>
                                        <C18601>1</C18601>
                                        <C18602>1500</C18602>
                                    </ns0:C186_2>
                                </ns0:QTY_2>
                                <ns0:DTM_13>
                                    <ns0:C507_13>
                                        <C50701>2</C50701>
                                        <C50702>20170520</C50702>
                                        <C50703>102</C50703>
                                    </ns0:C507_13>
                                </ns0:DTM_13>
                                <ns0:RFFLoop6>
                                    <ns0:RFF_6>
                                        <ns0:C506_6>
                                            <C50601>RE</C50601>
                                            <C50602>112</C50602>
                                        </ns0:C506_6>
                                    </ns0:RFF_6>
                                </ns0:RFFLoop6>
                            </ns0:QTYLoop2>
                        </ns0:SCCLoop1>
                        <ns0:SCCLoop1>
                            <ns0:SCC>
                                <SCC01>4</SCC01>
                                <ns0:C329>
                                    <C32901>D</C32901>
                                </ns0:C329>
                            </ns0:SCC>
                            <ns0:QTYLoop2>
                                <ns0:QTY_2>
                                    <ns0:C186_2>
                                        <C18601>1</C18601>
                                        <C18602>3000</C18602>
                                    </ns0:C186_2>
                                </ns0:QTY_2>
                                <ns0:DTM_13>
                                    <ns0:C507_13>
                                        <C50701>2</C50701>
                                        <C50702>20170601</C50702>
                                        <C50703>102</C50703>
                                    </ns0:C507_13>
                                </ns0:DTM_13>
                            </ns0:QTYLoop2>
                            <ns0:QTYLoop2>
                                <ns0:QTY_2>
                                    <ns0:C186_2>
                                        <C18601>1</C18601>
                                        <C18602>4000</C18602>
                                    </ns0:C186_2>
                                </ns0:QTY_2>
                                <ns0:DTM_13>
                                    <ns0:C507_13>
                                        <C50701>2</C50701>
                                        <C50702>20170701</C50702>
                                        <C50703>102</C50703>
                                    </ns0:C507_13>
                                </ns0:DTM_13>
                            </ns0:QTYLoop2>
                        </ns0:SCCLoop1>
                    </ns0:LINLoop1>
                </ns0:GISLoop1>
                <UNT>
                    <UNT1>34</UNT1>
                    <UNT2>1</UNT2>
                </UNT>
            </ns0:EFACT_D97A_DELFOR>
        </TransactionSet>
    </TransactionSetGroup>
    <ns0:UNZ xmlns:ns0="http://schemas.microsoft.com/Edi/EdifactServiceSchema">
        <UNZ1>1</UNZ1>
        <UNZ2>1</UNZ2>
    </ns0:UNZ>
</ins0:EdifactInterchangeXml>

预期输出

UNA:+.? '
UNB+UNOA:1+99:ZZ+96:ZZ+170501:1439+1++DELFOR++++1'
UNH+1+DELFOR:D:97A:UN'
BGM+241+20170501+5'
DTM+137:20170501:102'
DTM+158:20170501:102'
DTM+159:20171231:102'
NAD+SU+123456::92++TEST SUPPLIER'
GIS+36'
NAD+ST+123456789::16++TEST SHIP-TO PLANT+STREET 1:STREET 2:STREET3+CITYNAME+STATE+ZIP CODE+USA'
LIN+1++PART NUMBER 1:IN'
IMD+F++:::ITEM DESCRIPTION'
LOC+7+123'
RFF+ON:9999999'
QTY+48:4000:EA'
DTM+50:20170101:102'
RFF+SI:22222222'
QTY+3:8000:EA'
DTM+51:20170101:102'
DTM+52:20170501:102'
SCC+10++D'
QTY+1:1000'
DTM+2:20170501:102'
SCC+1++D'
QTY+1:2000'
DTM+2:20170510:102'
RFF+RE:111'
QTY+1:1500'
DTM+2:20170520:102'
RFF+RE:112'
SCC+4++D'
QTY+1:3000'
DTM+2:20170601:102'
QTY+1:4000'
DTM+2:20170701:102'
UNT+34+1'
UNZ+1+1'

原来的post中的xml是无效的,它有解码步骤输出结果的根节点。错误信息完全让我误入歧途。

xml 当然必须以正确的根元素名称开头,在本例中为:EFACT_D97A_DELFOR.

现在它就像一个魅力! :)

示例数据

<ns0:EFACT_D97A_DELFOR xmlns:ns0="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006">
    <UNH>
        <UNH1>1</UNH1>
        <UNH2>
            <UNH2.1>DELFOR</UNH2.1>
            <UNH2.2>D</UNH2.2>
            <UNH2.3>97A</UNH2.3>
            <UNH2.4>UN</UNH2.4>
        </UNH2>
    </UNH>
    <ns0:BGM>
        <ns0:C002>
            <C00201>241</C00201>
        </ns0:C002>
        <ns0:C106>
            <C10601>20170501</C10601>
        </ns0:C106>
        <BGM03>5</BGM03>
    </ns0:BGM>
    <ns0:DTM>
        <ns0:C507>
            <C50701>137</C50701>
            <C50702>20170501</C50702>
            <C50703>102</C50703>
        </ns0:C507>
    </ns0:DTM>
    <ns0:DTM>
        <ns0:C507>
            <C50701>158</C50701>
            <C50702>20170501</C50702>
            <C50703>102</C50703>
        </ns0:C507>
    </ns0:DTM>
    <ns0:DTM>
        <ns0:C507>
            <C50701>159</C50701>
            <C50702>20171231</C50702>
            <C50703>102</C50703>
        </ns0:C507>
    </ns0:DTM>
    <ns0:NADLoop1>
        <ns0:NAD>
            <NAD01>SU</NAD01>
            <ns0:C082>
                <C08201>123456</C08201>
                <C08203>92</C08203>
            </ns0:C082>
            <ns0:C080>
                <C08001>TEST SUPPLIER</C08001>
            </ns0:C080>
        </ns0:NAD>
    </ns0:NADLoop1>
    <ns0:GISLoop1>
        <ns0:GIS>
            <ns0:C529>
                <C52901>36</C52901>
            </ns0:C529>
        </ns0:GIS>
        <ns0:NADLoop2>
            <ns0:NAD_2>
                <NAD01>ST</NAD01>
                <ns0:C082_2>
                    <C08201>123456789</C08201>
                    <C08203>16</C08203>
                </ns0:C082_2>
                <ns0:C080_2>
                    <C08001>TEST SHIP-TO PLANT</C08001>
                </ns0:C080_2>
                <ns0:C059_2>
                    <C05901>STREET 1</C05901>
                    <C05902>STREET 2</C05902>
                    <C05903>STREET3</C05903>
                </ns0:C059_2>
                <NAD06>CITYNAME</NAD06>
                <NAD07>STATE</NAD07>
                <NAD08>ZIP CODE</NAD08>
                <NAD09>USA</NAD09>
            </ns0:NAD_2>
        </ns0:NADLoop2>
        <ns0:LINLoop1>
            <ns0:LIN>
                <LIN01>1</LIN01>
                <ns0:C212>
                    <C21201>PART NUMBER 1</C21201>
                    <C21202>IN</C21202>
                </ns0:C212>
            </ns0:LIN>
            <ns0:IMD>
                <IMD01>F</IMD01>
                <ns0:C273>
                    <C27304>ITEM DESCRIPTION</C27304>
                </ns0:C273>
            </ns0:IMD>
            <ns0:LOC_2>
                <LOC01>7</LOC01>
                <ns0:C517_2>
                    <C51701>123</C51701>
                </ns0:C517_2>
            </ns0:LOC_2>
            <ns0:RFFLoop4>
                <ns0:RFF_4>
                    <ns0:C506_4>
                        <C50601>ON</C50601>
                        <C50602>9999999</C50602>
                    </ns0:C506_4>
                </ns0:RFF_4>
            </ns0:RFFLoop4>
            <ns0:QTYLoop1>
                <ns0:QTY>
                    <ns0:C186>
                        <C18601>48</C18601>
                        <C18602>4000</C18602>
                        <C18603>EA</C18603>
                    </ns0:C186>
                </ns0:QTY>
                <ns0:DTM_11>
                    <ns0:C507_11>
                        <C50701>50</C50701>
                        <C50702>20170101</C50702>
                        <C50703>102</C50703>
                    </ns0:C507_11>
                </ns0:DTM_11>
                <ns0:RFFLoop5>
                    <ns0:RFF_5>
                        <ns0:C506_5>
                            <C50601>SI</C50601>
                            <C50602>22222222</C50602>
                        </ns0:C506_5>
                    </ns0:RFF_5>
                </ns0:RFFLoop5>
            </ns0:QTYLoop1>
            <ns0:QTYLoop1>
                <ns0:QTY>
                    <ns0:C186>
                        <C18601>3</C18601>
                        <C18602>8000</C18602>
                        <C18603>EA</C18603>
                    </ns0:C186>
                </ns0:QTY>
                <ns0:DTM_11>
                    <ns0:C507_11>
                        <C50701>51</C50701>
                        <C50702>20170101</C50702>
                        <C50703>102</C50703>
                    </ns0:C507_11>
                </ns0:DTM_11>
                <ns0:DTM_11>
                    <ns0:C507_11>
                        <C50701>52</C50701>
                        <C50702>20170501</C50702>
                        <C50703>102</C50703>
                    </ns0:C507_11>
                </ns0:DTM_11>
            </ns0:QTYLoop1>
            <ns0:SCCLoop1>
                <ns0:SCC>
                    <SCC01>10</SCC01>
                    <ns0:C329>
                        <C32901>D</C32901>
                    </ns0:C329>
                </ns0:SCC>
                <ns0:QTYLoop2>
                    <ns0:QTY_2>
                        <ns0:C186_2>
                            <C18601>1</C18601>
                            <C18602>1000</C18602>
                        </ns0:C186_2>
                    </ns0:QTY_2>
                    <ns0:DTM_13>
                        <ns0:C507_13>
                            <C50701>2</C50701>
                            <C50702>20170501</C50702>
                            <C50703>102</C50703>
                        </ns0:C507_13>
                    </ns0:DTM_13>
                </ns0:QTYLoop2>
            </ns0:SCCLoop1>
            <ns0:SCCLoop1>
                <ns0:SCC>
                    <SCC01>1</SCC01>
                    <ns0:C329>
                        <C32901>D</C32901>
                    </ns0:C329>
                </ns0:SCC>
                <ns0:QTYLoop2>
                    <ns0:QTY_2>
                        <ns0:C186_2>
                            <C18601>1</C18601>
                            <C18602>2000</C18602>
                        </ns0:C186_2>
                    </ns0:QTY_2>
                    <ns0:DTM_13>
                        <ns0:C507_13>
                            <C50701>2</C50701>
                            <C50702>20170510</C50702>
                            <C50703>102</C50703>
                        </ns0:C507_13>
                    </ns0:DTM_13>
                    <ns0:RFFLoop6>
                        <ns0:RFF_6>
                            <ns0:C506_6>
                                <C50601>RE</C50601>
                                <C50602>111</C50602>
                            </ns0:C506_6>
                        </ns0:RFF_6>
                    </ns0:RFFLoop6>
                </ns0:QTYLoop2>
                <ns0:QTYLoop2>
                    <ns0:QTY_2>
                        <ns0:C186_2>
                            <C18601>1</C18601>
                            <C18602>1500</C18602>
                        </ns0:C186_2>
                    </ns0:QTY_2>
                    <ns0:DTM_13>
                        <ns0:C507_13>
                            <C50701>2</C50701>
                            <C50702>20170520</C50702>
                            <C50703>102</C50703>
                        </ns0:C507_13>
                    </ns0:DTM_13>
                    <ns0:RFFLoop6>
                        <ns0:RFF_6>
                            <ns0:C506_6>
                                <C50601>RE</C50601>
                                <C50602>112</C50602>
                            </ns0:C506_6>
                        </ns0:RFF_6>
                    </ns0:RFFLoop6>
                </ns0:QTYLoop2>
            </ns0:SCCLoop1>
            <ns0:SCCLoop1>
                <ns0:SCC>
                    <SCC01>4</SCC01>
                    <ns0:C329>
                        <C32901>D</C32901>
                    </ns0:C329>
                </ns0:SCC>
                <ns0:QTYLoop2>
                    <ns0:QTY_2>
                        <ns0:C186_2>
                            <C18601>1</C18601>
                            <C18602>3000</C18602>
                        </ns0:C186_2>
                    </ns0:QTY_2>
                    <ns0:DTM_13>
                        <ns0:C507_13>
                            <C50701>2</C50701>
                            <C50702>20170601</C50702>
                            <C50703>102</C50703>
                        </ns0:C507_13>
                    </ns0:DTM_13>
                </ns0:QTYLoop2>
                <ns0:QTYLoop2>
                    <ns0:QTY_2>
                        <ns0:C186_2>
                            <C18601>1</C18601>
                            <C18602>4000</C18602>
                        </ns0:C186_2>
                    </ns0:QTY_2>
                    <ns0:DTM_13>
                        <ns0:C507_13>
                            <C50701>2</C50701>
                            <C50702>20170701</C50702>
                            <C50703>102</C50703>
                        </ns0:C507_13>
                    </ns0:DTM_13>
                </ns0:QTYLoop2>
            </ns0:SCCLoop1>
        </ns0:LINLoop1>
    </ns0:GISLoop1>
    <UNT>
        <UNT1>34</UNT1>
        <UNT2>1</UNT2>
    </UNT>
</ns0:EFACT_D97A_DELFOR>