【问题标题】:replace function with get-property in wso2esb在 wso2esb 中用 get-property 替换函数
【发布时间】:2018-12-13 22:25:01
【问题描述】:

我正在尝试以下选项,但我遇到了错误,任何人都可以建议我解决方案。我添加了 synapse.xpath.dom.failover.enabled=true 代码:试图用属性值替换~TOKEN~

<property name="verificationLink" expression="fn:replace($ctx:reqVerifyUrl , '~TOKEN~', get-property('verification_code'))" scope="default" type="STRING" xmlns:fn="http://www.w3.org/2005/xpath-functions" />

错误:

TID: [-1234] [] [2017-02-15 00:14:19,318] ERROR {org.apache.synapse.util.xpath.SynapseXPath} - Evaluation of the XPath expression fn:replace($ctx:reqVerifyUrl , '~TOKEN~', get-property('verification_code')) resulted in an error {org.apache.synapse.util.xpath.SynapseXPath} net.sf.saxon.trans.XPathException: Unknown system function get-property()

【问题讨论】:

    标签: wso2 wso2esb


    【解决方案1】:

    get-property 不是标准的 xpath 函数,你必须告诉 xpath 引擎这个函数来自 synapse:

    <property name="verificationLink" expression="fn:replace($ctx:reqVerifyUrl , '~TOKEN~', syn:get-property('verification_code'))" scope="default" type="STRING" xmlns:fn="http://www.w3.org/2005/xpath-functions" />
    

    你不需要添加'syn'命名空间的定义,它在你的中介中是众所周知的(xmlns:syn="http://ws.apache.org/ns/synapse")

    【讨论】:

      【解决方案2】:

      需要做两件事:

      A.查看此内容并确保您的 Synapse 配置设置正确。 Is there any replace function in wso2esb?

      B.然后,如果您需要在 XPath 2.0 中使用诸如 get-property() 之类的方法,则需要添加前缀 fn 和 syn。另请注意,您必须为“syn”和“fn”使用(包含)以下命名空间值。

      xmlns:syn=”http://ws.apache.org/commons/ns/payload” 
      xmlns:fn=”http://www.w3.org/2005/xpath-functions”
      

      这是一个使用替换的示例属性中介。

          <property xmlns:syn="http://ws.apache.org/commons/ns/payload" xmlns:fn="http://www.w3.org/2005/xpath-functions" name="xmlValue" expression="fn:replace(syn:get-property('textValue'), 'xmlData=', '')></property>;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2013-01-06
        • 1970-01-01
        • 2020-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-01-29
        相关资源
        最近更新 更多