Search code examples
dynamicwso2endpointvfs

dynamic VFS endpoint


I need to create folder on storage. The folder name is dynamic and comes from incoming request. I tried with concatenated full path in property 'transport.vfs.ReplyFileName' without success and still use the uri property in the address endpoint:

<property description="concat path and DestinationFolder" expression="fn:concat(get-property('path'),get-property('DFolder'))" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
            <property description="OUT_ONLY=true" name="OUT_ONLY" scope="default" type="STRING" value="true"/> 
 <endpoint>
    <address uri="vfs:file://D:\\temp_WSO2\\Downloads\\">
    </address>
 </endpoint>

Anyone with idea how to solve that situation? Thanks in advance!


Solution

  • You can use the To header property to set a dynamic path. Your can then contain an anonymous endpoint.

    <header name="To" expression="fn:concat(get-property('path'),get-property('DFolder'))"/>
    <property description="OUT_ONLY=true" name="OUT_ONLY" scope="default" type="STRING" value="true"/> 
    <send>
        <endpoint>
            <default/>
        </endpoint>
    </send>
    

    You can see examples on the WSO2 documentation.