wso2 - 如何从注册表资源中读取本地条目的内容

标签 wso2 wso2-esb

我使用本地条目来注册参数,而不是在工件中固定,我不知道这是否是更好的解决方案。

当我在 ESB Config 中创建本地条目时,一切正常,但当我在项目注册表资源中创建时,我无法正确读取。

我使用下面的代码来读取本地条目并写入属性:

<Property description = "SetPPSUserName" expression = "get-property ('registry', 'conf: /local-entries/PPS_Username.xml')" name = "SetPPSUserName" scope = "default" type = "STRING" />

问题是它加载本地条目的整个 xml 内容,而不仅仅是内容,例如属性:

SetPPSUserName = "<localEntry key="PPS_Username" xmlns="​http://ws.apache.org/ns/synapse"><![CDATA [content test blablab]]></ localEntry>"

正确的是:

SetPPSUserName = "content test blablab"

注意:当我将CAR上传到站点时,项目注册表资源的本地条目不会出现在管理控制台的本地条目列表中。

使用谷歌翻译器将消息从葡萄牙语翻译成英语

最佳答案

试试这个:

在属性中设置 type = OM 而不是 STRING。

<Property description = "SetPPSUserName" expression = "get-property ('registry', 'conf: /local-entries/PPS_Username.xml')" name = "SetPPSUserName" scope = "default" type = "OM" />

<log level="custom">
<property name="call_testProp" expression="$ctx:SetPPSUserName" type="STRING"/>
</log>

更新1:

注册表中我的 localEntry:

<localEntry key="PPS_Usernamelocal" xmlns="http://ws.apache.org/ns/synapse">
<a>
  <b>TEST</b>
</a>
</localEntry>

我的 esb 代理内的属性和日志中介:

 <property name="PPS_Username"
           expression="get-property('registry','conf:/localentries/PPS_Username.xml')"
           scope="default"
           type="OM"/>        
 <log level="custom">
    <property name="PPS_UsernameB" expression="$ctx:PPS_Username//syn:a/syn:b" xmlns:syn="http://ws.apache.org/ns/synapse"/>                                        
 </log>

我的 ESB 回复:

[2017-02-22 16:21:42,680]  INFO - LogMediator PPS_UsernameB = TEST

关于wso2 - 如何从注册表资源中读取本地条目的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42352713/

相关文章:

wso2 - 使用 scim2 apis 在 wso2 中添加用户时如何添加角色/组是 5.9.0?

具有非 WSO2 ESB 的 WSO2 API 管理器?

ssl - WSO2 ESB 使用轴服务的计算机名称

wso2-data-services-server - 使用 ESB 部署时数据服务失败

algorithm - 为 WSO2 ESB 编写负载均衡算法

windows - 是否建议在 Windows 上运行 WSO2 ESB 进行生产?

java - 是否有像 FRAPI (PHP) 这样但适用于 Java 的 REST Web 服务 API 提供程序?

带分析功能的 WSO2 API 管理器 : stats-datasources. xml' - 系统数据源 WSO2AM_STATS_DB 无法更新

web-services - 如何配置 WSO2 ESB 4.0.3 以使用企业代理访问外部 Web 服务(通过 HTTP)

wso2 - JDBCUserStoreManager 配置为辅助用户存储在 wso2esb 中不起作用