[英]WSO2 ESB Iterate over DSS response (json array)
我在迭代 dss 的呼叫響應時遇到問題。 我有2台服務器
安裝了數據服務 (4.3.4) 功能的 WSO2 ESB 服務器 (4.9.0) WSO2 應用程序服務器 (5.3.0)
我做一個有效載荷
<payloadFactory media-type="xml">
<format>
<p:valoresReport xmlns:p="ReportsDataService">
<xs:uuid xmlns:xs="ReportsDataService">$1</xs:uuid>
</p:valoresReport>
</format>
<args>
<arg value="123456789"/>
</args>
</payloadFactory>
並通過端點進行呼叫
<call blocking="true">
<endpoint key="ReportsDataServiceEndPoint"/>
</call>
回應是:
<ReportRowSet xmlns="ReportsDataService">
<reportRow>
<column1>1</column1>
<column2>2</column2>
<column3>3</column3>
</reportRow>
<reportRow>
<column1>columna 1</column1>
<column2>olumna 2</column2>
<column3>columna 3</column3>
</reportRow>
</ReportRowSet>
要閱讀響應,我將 de messageType 更改為 json
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
並使用 json-eval 獲取值。
<property expression="json-eval($.ReportRowSet.reportRow)" name="rows"
scope="default" type="STRING"/>
我可以記錄財產
<log level="custom">
<property expression="$ctx:rows" name="ROWS"/>
</log>
輸出:
[2016-05-31 16:21:38,489] INFO - LogMediator ROWS = [{"column1":1,"column3":3,"column2":2},{"column1":"columna 1","column3":"columna 3","column2":"olumna 2"}]
但是當我嘗試迭代行時,我不知道該怎么做(這種方式不起作用)
<iterate continueParent="true" expression="$ctx:rows"
id="MyIterator" sequential="true">
<target>
<sequence>
...
我也嘗試過但沒有成功(沒有改變消息類型):
<iterate continueParent="true" expression="//ReportRowSet/reportRow"
id="MyIterator" sequential="true">
進行這種集成和迭代的正確形式是什么。
我讓你我的 dss 和序列:
ReportsDataService.dbs:[ https://drive.google.com/open?id=0B44t8SdKZz79ellKVmpkM0t6Rmc ]
GenerarReporteSequence.xml:[ https://drive.google.com/open?id=0B44t8SdKZz79YlkxMnNnNm8weGs ]
嘗試在迭代器介體中使用適當的命名空間,示例如下,
<iterate xmlns:ns1="ReportsDataService" id="MyIterator" expression="//ns1:ReportRowSet/ns1:reportRow" sequential="true">
<target>
<sequence>
<log level="custom">
<property name="col" expression="//ns1:column1"/>
</log>
<call>
<endpoint>
<http uri-template="http://endpoint.url"/>
</endpoint>
</call>
</sequence>
</target>
</iterate>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.