【发布时间】:2020-05-07 08:25:03
【问题描述】:
在我的例子中,第一个后端调用的响应是 Array of Objects 格式,如下所示:
回复:
"Entity": {
"related-List": [
{
"fname": "abc",
"lname": "xyz",
"bdate": "2013-01-25",
"accType": "Cur",
"accNum": "54736",
"bal": 901,
"address": "USA"
},
{
"fname": "def",
"lname": "pqr",
"bdate": "2013-01-25",
"accType": "Sav",
"accNum": "12345",
"bal": 901,
"address": "USA"
},
{
"fname": "ghi",
"lname": "stu",
"bdate": "2013-01-25",
"accType": "Dep",
"accNum": "87654",
"bal": 901,
"address": "USA"
}
]
}
******************/
所以在第二次调用中,我想使用响应中的“accType”和“accNum”,并对响应数组中存在的对象数量进行后端调用。为此,我需要使用 Iterate 或 ForEach 之类的:
<foreach>
<call>
<endpoint>
<http method="POST" uri-template="http://localhost:6754/v2/{accType}/{accNum}"/>
</endpoint>
</call>
</foreach>
或
<iterate>
<call>
<endpoint>
<http method="POST" uri-template="http://localhost:6754/v2/{accType}/{accNum}"/>
</endpoint>
</call>
</iterate>
实现它的正确方法是什么?
【问题讨论】: