0
這是我的背景: 我有這樣的身體JSON:遍歷在WSO2 ESB陣列
{
"delivery": [
{
"note": "aaaaaa",
"method": "x"
},
{
"note": "bbb",
"method": "y"
},
{
"note": "ccc",
"method": "x"
}
],
"partner": {
"zip": "a",
"country": "b",
"city": "c"
}
}
我需要遍歷交付陣列和創建對象(投遞物品+夥伴對象),然後撥打電話到端點。
例如,這第一個對象:
{
"delivery":
{
"note": "aaaaaa",
"method": "x"
}
"partner": {
"zip": "a",
"country": "b",
"city": "c"
}
}
,然後撥打電話到端點
該操作將被重複X = array.lenght
我創建這個序列,但它不」 t work
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="tec_notif-expe_v1" xmlns="http://ws.apache.org/ns/synapse">
<in>
<property name="RESPONSE" scope="default" value="true"/>
<property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>
<header action="remove" name="To"/>
<property name="partner" expression="json-eval($.partner)" scope="default" />
<!-- iterate over delivery-->
<iterate continueParent="true" expression="//delivery">
<target sequence="anon">
<sequence>
<property name="deliveryItem" expression="//delivery" />
<script language="js"><![CDATA[
var body = {};
body.delivery = {};
body.partner = {};
body.delivery = mc.getProperty('deliveryItem');
body.partner = mc.getProperty('partner');
mc.setPayloadJSON(body);
]]></script>
<call>
<endpoint key="update-eklem"/>
</call>
</sequence>
</target>
</iterate>
<send />
<drop />
</in>
</sequence>
你有什麼建議嗎?
致以問候