Writing files

Now that we know how to read files, we will learn how to use the VFS transport for writing content to files, no matter what the source of the data is: another file, API, Proxy service, inbound endpoint, task, or any other.

For writing the file, we need to create an endpoint with the path where the file will be created:

  • Local
  • FTP
  • Samba

This endpoint will be used inside a send or call mediator, as follows:

<call>
    <endpoint>
        <address uri="vfs:file:///home/user/vfs/out"/>
    </endpoint>
</call>

When we want to create a file, we need to use the OUT_ONLY property, because this is a single-way operation and the server does not need to wait for a response. Another property that we use in the write file process is ReplyFileName, which ...

Get WSO2 Developer’s Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.