soap:DateWeave(json转xml映射,xml中包含json)

案例:
soap:DateWeave(json转xml映射,xml中包含json)_第1张图片

来源结构json:

{
    "param": "{\"bus_account\":\"2950891\",\"interface_code\":\"JK20230320000002\",\"body\":{\"data\":{\"list\":[{\"refundsDeliveryNumber\":\"INSD202303310523\",\"refundsDeliveryTime\":\"2023-04-03 00:00:00\",\"refundsDeliveryType\":\"IQC_RETURN\",\"toElsAccount\":\"VEN00039\",\"refundsDeliveryStatus\":\"6\",\"refundsReason\":\"\",\"refundsPrincipal\":\"节卡.孙\",\"purchaseOrg\":\"C002\",\"purchaseRefundsDeliveryItemList\":[{\"orderNumber\":\"CGDDR20230329\",\"materialNumber\":\"2209000031\",\"refundsQuantity\":\"\",\"itemStatus\":\"7\",\"orderItemNumber\":\"10\",\"storageLocation\":\"W201\"}]},{\"refundsDeliveryNumber\":\"INSD202303311046\",\"refundsDeliveryTime\":\"2023-03-31 00:00:00\",\"refundsDeliveryType\":\"IQC_RETURN\",\"toElsAccount\":\"VEN00039\",\"refundsDeliveryStatus\":\"6\",\"refundsReason\":\"\",\"refundsPrincipal\":\"节卡.孙\",\"purchaseOrg\":\"C002\",\"purchaseRefundsDeliveryItemList\":[{\"orderNumber\":\"CGDDR20230329\",\"materialNumber\":\"2209000031\",\"refundsQuantity\":\"\",\"itemStatus\":\"7\",\"orderItemNumber\":\"10\",\"storageLocation\":\"W201\"}]}]},\"busAccount\":\"2950891\",\"simpleFlag\":\"1\",\"interfaceCode\":\"getRefundsDeliveryHeadFromWms\"}}",
    "secret": "8ed9e3c00f5b4e78bc2650be619db1fa",
    "key": "dba2b4a8"
}

目标结构xml:



  
    dba2b4a8
    8ed9e3c00f5b4e78bc2650be619db1fa
  
  
    
      {"bus_account":"2950891","interface_code":"JK20230320000002","body":{"data":{"list":[{"refundsDeliveryNumber":"INSD202303310523","refundsDeliveryTime":"2023-04-03 00:00:00","refundsDeliveryType":"IQC_RETURN","toElsAccount":"VEN00039","refundsDeliveryStatus":"6","refundsReason":"","refundsPrincipal":"节卡.孙","purchaseOrg":"C002","purchaseRefundsDeliveryItemList":[{"orderNumber":"CGDDR20230329","materialNumber":"2209000031","refundsQuantity":"","itemStatus":"7","orderItemNumber":"10","storageLocation":"W201"}]},{"refundsDeliveryNumber":"INSD202303311046","refundsDeliveryTime":"2023-03-31 00:00:00","refundsDeliveryType":"IQC_RETURN","toElsAccount":"VEN00039","refundsDeliveryStatus":"6","refundsReason":"","refundsPrincipal":"节卡.孙","purchaseOrg":"C002","purchaseRefundsDeliveryItemList":[{"orderNumber":"CGDDR20230329","materialNumber":"2209000031","refundsQuantity":"","itemStatus":"7","orderItemNumber":"10","storageLocation":"W201"}]}]},"busAccount":"2950891","simpleFlag":"1","interfaceCode":"getRefundsDeliveryHeadFromWms"}}
    
  

脚本:

%dw 2.0         
output application/xml         
ns soap http://www.w3.org/2003/05/soap-envelope         
ns qqt https://www.51qqt.com         
---         
{
        soap#Envelope: {
                soap#Header: {
                        qqt#key: payload.key,
                        qqt#secret: payload.secret,
                },
                soap#Body: {
                        qqt#invokeByKey: {
                                param: payload.param
                        },
                },
        },
}

你可能感兴趣的:(json,xml,servlet)