WSO2 EI / ESB中的顺序后端调用

时间:2020-05-07 08:25:03

标签: wso2 wso2esb esb wso2ei

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

响应:

 componentWillMount(){
     setInterval(() => {
      fetch('http://localhost:5000/sensors')
      .then(res => res.json())
      .then(json => {
        this.setState({
          isLoaded: true,
          sensors: json,
        })
        console.log(this.state.sensors);
      });
     }, 40000);
   }

************* /

因此,在第二个调用中,我想使用响应中的“ accType”和“ accNum”,并对响应数组中存在的对象数进行后端调用。为此,我需要像这样使用Iterate或ForEach:

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

OR

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

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

1 个答案:

答案 0 :(得分:1)

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