【发布时间】:2020-07-13 02:03:24
【问题描述】:
Check image to view mule4 screen 我正在使用 mule4 构建集成流、用于数据转换的 Dataweave 表达式和用于测试 HTTP 调用的邮递员,我正在尝试从 Dataweave 中的 XML 下面获取 0011x000014VegoAAC 并插入到 Salesforce 记录中 一切正常,直到我添加了这两行(他们应该从 XML 中提取 0011x000014VegoAAC)
PBSI__Customer__c: (payload.ns0#order.ns0#"custom-attributes".*ns0#"custom-attribute")
filter (item) -> (item.@"attribute-id" == "sscAccountid")
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<order order-no="00000907" xmlns="http://www.demandware.com/xml/impex/order/2006-10-31">
<order-date>2020-07-10T08:57:05.076Z</order-date>
<current-order-no>00000907</current-order-no>
<product-lineitems>
<product-lineitem>
<net-price>54.17</net-price>
</product-lineitem>
</product-lineitems>
<custom-attributes>
<custom-attribute attribute-id="Adyen_pspReference">852594371442812G</custom-attribute>
<custom-attribute attribute-id="Adyen_value">7099</custom-attribute>
<custom-attribute attribute-id="sscAccountid">0011x000014VegoAAC</custom-attribute>
</custom-attributes>
</order>
完整的 Dataweave 代码
%dw 2.0
output application/java
ns ns0 http://www.demandware.com/xml/impex/order/2006-10-31
---
[{
Ascent4Ecomm__Ecomm_Order_ID__c: payload.ns0#order.ns0#"original-order-no",
Ascent4Ecomm__Ecomm_Order_Name__c: payload.ns0#order.ns0#"original-order-no",
Ascent4Ecomm__Ecomm_Order_Number__c: payload.ns0#order.ns0#"original-order-no",
attributes: {
"type": "PBSI__PBSI_Sales_Order__c",
"referenceId": "SO"
},
PBSI__Sales_Order_Lines__r: {
records: payload.ns0#order.ns0#"product-lineitems".*ns0#"product-lineitem" map ( e , empindex ) -> {
"attributes": {
"type": "PBSI__PBSI_Sales_Order_Line__c",
"referenceId": e.ns0#"product-id"
},
"PBSI__Item__c": e.ns0#"custom-attributes".ns0#"custom-attribute",
"PBSI__ItemDescription__c": e.ns0#"product-name"
}
},
***These two lines throws error:***
PBSI__Customer__c: (payload.ns0#order.ns0#"custom-attributes".*ns0#"custom-attribute")
filter (item) -> (item.@"attribute-id" == "sscAccountid")
}]
错误
:Invalid status code: 400, response body: [{"message":"Cannot deserialize instance of reference from START_ARRAY value [line:1, column:423]","errorCode":"JSON_PARSER_ERROR"}]
在这两行之前一切正常[Mule4 screen][2]
我正在使用邮递员对该流进行 HTTP 调用
【问题讨论】:
-
提供更多详细信息,例如,您能否确定哪个处理器在您的流程中引发错误?你能分享一下配置 XML 或者一个能说明问题的项目吗?
-
那是 HTTP 错误,日志中完整的 DataWeave 错误是什么?
-
我用更多信息更新了我的帖子,我正在使用 mule4 构建集成流程和邮递员来测试 HTTP 调用