我们如何使用 Xpath 在 Wso2esb 中破坏字符串 [英] How We Can Break a String in Wso2esb using Xpath

查看:17
本文介绍了我们如何使用 Xpath 在 Wso2esb 中破坏字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用 xpath 打破 wso2esb 中的字符串我的输入是这样的

I wish to break a string in wso2esb using xpath my input like this

<property name="Message" value="assetname:ups,assetcode:452chi,assetid:548935,assetvalue:215" scope="default"/>

我需要使用 xpath 中断相同的属性我需要这样的

i need break in same property using xpath i need like this

assetname:ups
assetcode=452chi
assetid=54895
assetvalue=215

为此,我尝试使用 tokenize 函数,但 wso2esb 显示错误我的配置文件

for this i tried with tokenize function but wso2esb showing errors my configure file

<proxy xmlns="http://ws.apache.org/ns/synapse" name="Xpathcheck" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <property name="max" value="1" scope="default" type="STRING"/>
         <property name="min" value="1" scope="default" type="STRING"/>
         <property name="MessageText" expression="fn:concat('Assetid:',get-property('min'),',','Assetname:',get-property('max'))" scope="default" type="STRING"/>
         <property name="Tokenize" expression="fn:tokenize(get-property('Messagetext'),',')" scope="default" type="STRING"/>
         <log>
            <property name="MessageText" expression="get-property('MessageText')"/>
            <property name="Tokenize" expression="get-property('Tokenize')"/>
         </log>
               </inSequence>
      <outSequence/>
   </target>
   <description></description>
</proxy>

但是像这样的抛出错误你有任何想法我需要将它作为一个字段存储在 Db 表中,看起来像单独的行错误是

But its throwing errors like this u have any idea for this i need store this in Db table as a one field which look like separate lines error is

ERROR - SynapseXPath Evaluation of the XPath expression fn:tokenize(get-property('Messagetext'),',') resulted in an error
org.jaxen.UnresolvableException: No Such Function tokenize

推荐答案

tokenize 是 XPath 2.0 自带的一个函数.要启用 XPath 2.0 功能,请取消注释位于 $ESB_HOME/repository/conf 目录下的 synapse.properties 文件中的以下条目

tokenize is a function comes with XPath 2.0. To enable XPath 2.0 functions uncomment the following entry in the synapse.properties file which is located at $ESB_HOME/repository/conf directory

synapse.xpath.dom.failover.enabled=true

那么你必须如下指定中介,

then you have to specify the mediator as follows,

<property name="Message" value="a,b,c,d,e" scope="default"/>
         <property xmlns:fn="http://www.w3.org/2005/xpath-functions" name="Tokenize" expression="fn:tokenize(syn:get-property('Message'),',')" scope="default" type="STRING"/>

这篇关于我们如何使用 Xpath 在 Wso2esb 中破坏字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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