WSO2 EI / ESB中的顺序后端调用 [英] Sequential back-end calls in WSO2 EI/ESB

查看:114
本文介绍了WSO2 EI / ESB中的顺序后端调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的情况下,来自第一个后端调用的响应采用对象数组格式,如下所示:

In my case, the response from the first back-end call is in Array of Objects format as below:

响应:

"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,例如:

So in the second call, I want to use the "accType" and "accNum" from the response and make the back-end call for the number of objects present in the response array. For this, I need to use Iterate or ForEach like:

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

实现它的正确方法是什么?

推荐答案

您不能在Foreach中介器中使用发送或呼叫中介器。因此,您必须使用Iterate中介器。您可以将中介者表达式用作 json-eval($。Entity.related-List)并遍历数组。

You cannot use Send or Call mediators inside Foreach mediator. Hence you have to use Iterate mediator. You can use Iterate mediator expression as json-eval($. Entity.related-List) and iterate through the array.

这篇关于WSO2 EI / ESB中的顺序后端调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆