WSO2 EIESB中的连续后端调用。

问题描述 投票:0回答:1

在我的案例中,第一个后端调用的响应是在 对象阵列 格式如下。

答复: ***************。

"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>

OR

<iterate>
    <call>
                <endpoint>
                   <http method="POST" uri-template="http://localhost:6754/v2/{accType}/{accNum}"/>
                </endpoint>
    </call>
</iterate>

正确的实现方式是什么?

wso2 wso2esb esb wso2ei
1个回答
5
投票

你不能在Foreach介子中使用Send或Call介子,因此你必须使用Iterate介子。因此你必须使用Iterate mediator。你可以使用 Iterate mediator 表达式为 json-eval($. Entity.related-List) 并对数组进行迭代。

© www.soinside.com 2019 - 2024. All rights reserved.