如何访问在迭代器中定义的迭代器之外的属性介体? [英] How to access property mediator outside iterator which is defined inside iterator?

查看:133
本文介绍了如何访问在迭代器中定义的迭代器之外的属性介体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按以下方式处理

<iterate xmlns:oag="http://www.openapplications.org/oagis/10" xmlns:fn="http://www.w3.org/2005/xpath-functions" continueParent="true" preservePayload="true" attachPath="//ProcessCredit/DataArea" expression="//ProcessCredit/DataArea/Credit sequential="true">
.....
 <property xmlns:ns="http://org.apache.synapse/xsd"
                        xmlns:oa="http://www.openapplications.org/oagis/10"
                        name="ChargeTransactionKey"
                        expression="concat(get-property('operation','ChargeTransactionKey'),//Extension/ValueText[@typeCode='Charge Transaction Key'],':')"
                        scope="operation"
                        type="STRING"
                        description="ChargeTransactionKey"/>
 ...........

</iterate >
<log level="full">
<property name="requestIdChargeTransactionKey"
                  expression="get-property('operation','ChargeTransactionKey')"/>
     </log>

但属性requestIdChargeTransactionKey中的值为null,这意味着我无法捕获属性在迭代器中定义。

but value in property "requestIdChargeTransactionKey" is null, it means I'm unable to capture the property which is defined inside iterator.

任何人都可以帮助语法吗?

can anybody help on syntax?

推荐答案

iterate中的中介使用MessageContext的克隆。如果继续父调解(将continueParent属性设置为true),则使用初始MessageContext,因此在迭代中使用范围'default'设置的所有属性都将丢失

The mediation inside iterate works with clones of MessageContext. If you continue parent mediation (set continueParent attribute to true), you work with the initial MessageContext and therefore all the properties you have set with scope 'default' inside iterate are lost

但是有一个名为'operation'的作用域用于在操作上下文级别中检索属性,如果在iterate中设置一个具有此作用域的属性,则可以在父调解中获取它的值

But there is a scope named 'operation' used to retrieve a property in the operation context level and if you set a property with this scope inside iterate, you can get it's value in the parent mediation

内部迭代:

<property name="ChargeTransactionKey" value="xxx" scope="operation"/>

在父母调解中:

get-property('operation','ChargeTransactionKey')

这篇关于如何访问在迭代器中定义的迭代器之外的属性介体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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