xmlconcatenationjsonpathapache-synapsewso2-esb

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


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.


Solution

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