Question

I write a file with vfs to a folder which does not exist. I expect an exception or creation of this folder. But none of them happen, instead there is a file created with the missing folder name (at least the content of the file is then correct).

But this behaviour is not what i want - a missing folder should be either created or an exception should be thrown. Here is my example of the Sequence sending a file to an FTP:

<property name="OUT_ONLY" value="true"/>    
<property name="transport.vfs.ReplyFileName" value="filename.txt" scope="transport"/>
    <send>
       <endpoint>
          <address uri="vfs:ftp://USER:PASSWORD@SERVER/myFolder"/>
       </endpoint>
    </send>

When the proxy tries to write the file and the folder "myFolder" does not exist, there is a file written with the correct content with the filename “myFolder” instead of filename.txt inside of myFolder.

By the way the issue does also exist on a local file (not FTP specific)

Does anyone have a solution for this problem?

Was it helpful?

Solution

As far as I know, WSO2 is able to create folder but the file name will be messed up, for example, with an address like this

<address uri="vfs:ftp://USER:PASSWORD@SERVER/myFolder1/myFolder2"/>

Assume myFolder1 and myFolder2 dont' exist. myFolder1 will be created but myFolder2 won't, the filename will be changed to myFolder2 with correct content.

Instead, you can add the folder name to ReplyFileName property, the folder should be created without problem.

 <property name="transport.vfs.ReplyFileName" value="myFolder/filename.txt" scope="transport"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top