通过 servce 更新 wso2 esb 中的本地条目 [英] update local entry in wso2 esb via servce
本文介绍了通过 servce 更新 wso2 esb 中的本地条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以从 esb 服务更新本地条目.我必须在全局变量中存储一个令牌,并且需要在它过期时更新它.我想将它保留在本地条目中.看起来我无法从 ESB 服务/序列更新它.
Is there any way by which, I can update local entry from esb service. I have to store a token in global variable and need to update it when it is expired. I want to keep it in local entry. Looks like I can not update it from ESB service/sequence.
<localEntry key="TestLocalEntry" xmlns="http://ws.apache.org/ns/synapse"><![CDATA[TestValue]]></localEntry>
推荐答案
我已经用 java 脚本解决了这个问题.
I have managed to fix this problem with java script.
获取属性值使用:
<script language="js"><![CDATA[var Token = mc.getEnvironment().getServerContextInformation().getProperty("TokenVal");
mc.setProperty("TokenVal",Token);]]></script>
<property expression="$ctx:TokenVal" name="TokenValue"
type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
并更新值使用:
<script language="js"><![CDATA[var TokenValue = mc.getProperty("TokenValue");
mc.getEnvironment().getServerContextInformation().addProperty("TokenVal",TokenValue);
]]></script>
但即便如此,如果我们在 wso2 esb 中有任何注册表资源,我还是想使用注册表资源
but even then, I want to use registry resources if we have any in wso2 esb
这篇关于通过 servce 更新 wso2 esb 中的本地条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文