无法使用 json-eval 在 WSO2 ESB CONFIGURATION 中应用 concat 函数

Can't apply concat function in WSO2 ESB CONFIGURATION with json-eval

我正在尝试设置此表达式以获得输出文件名作为城市名称和文件扩展名之间的连接:

<?xml version="1.0" encoding="UTF-8"?>
<sequence name="WriteFile_City" xmlns="http://ws.apache.org/ns/synapse">
<property expression="concat(json-eval($.city.name),'.xml')"
    name="transport.vfs.ReplyFileName" scope="transport"
    type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>
<property name="OUT_ONLY" value="true"/>
<send>
    <endpoint>
        <address uri="vfs:file:///C:/myFolder"/>
    </endpoint>
</send>
</sequence>

如果我只尝试插入城市名称,它会起作用:第三行将是

<property expression="json-eval($.city.name)"

并且通过这种方式,我将输出保存在一个名为 "London" 的文件中。但是我需要将输出保存为 "London.xml",但我不明白这个 concat 函数的问题在哪里。

你试过 fn:concat(json-eval($.city.name),'.xml') 而不是简单的 concat(....) 吗? 我知道在使用带有某些表达式的函数时我已经添加了问题。我通常也尝试先声明一个 属性 然后像

一样使用它
<property expression="json-eval($.city.name)" name="city"/>
<property expression="concat(get-property('city'),'.xml')"
name="transport.vfs.ReplyFileName" scope="transport"
type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>

那里,正确的做法是:

    <property expression="fn:concat(get-property('city'),'.xml')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>

您可以如下使用,

<property expression="json-eval($.city.name)" name="city"/>
<property expression="fn:concat($ctx:city, '.xml')" name="name-of-attribute" type="STRING" scope="default"/>

如果您想连接多个参数,请按如下方式使用,

<property expression="fn:concat($ctx:city ,'.', 'xml')" name="name-of-attribute" type="STRING" scope="default"/>