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

谁说我不能喝 提交于 2019-12-23 23:17:39

问题


I'm trying to set this expression in order to obtain the output file name as a concat between the name of the city and the extention of the file:

<?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>

If I only try to insert the name of the city, it works: the third line would be

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

and in this way i save my output in a file named "London", for example. But i need to save output as "London.xml", but i can't understand where is the problem with this concat function.


回答1:


did you tried fn:concat(json-eval($.city.name),'.xml') instead of simply concat(....) ? I know that I already add issue when using functions with some expression. I generally also try to first declare a property and then use it like

<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"/>



回答2:


there, the right way is:

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


来源:https://stackoverflow.com/questions/41631258/cant-apply-concat-function-in-wso2-esb-configuration-with-json-eval

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!