The ESB can access the local file system using the VFS transport sender and receiver. This sample demonstrates the VFS transport in action, using the file system as a transport medium.
- Enable the VFS transport. For details, see Enable VFS.
- Create 3 new directories (folders) named in, out and original in a suitable location in a test directory (e.g., /home/user/test) in the local file system. Then, open the
repository/sample/synapse_sample_254.xmlfile in a text editor and change the
transport.vfs.MoveAfterFailureparameter values to the in, original and original directory locations respectively. You need to set both
transport.vfs.MoveAfterFailureparameter values to point to the original directory location.Change the endpoint in the
<outSequence>to point to the out directory location. Make sure that the prefix
vfs:in the endpoint URL is not removed or changed.
- For a list of general prerequisites, see Prerequisites to Start the ESB Samples.
Building the sample
The XML configuration for this sample is as follows:
This configuration file
synapse_sample_254.xml is available in the
<ESB_HOME>/repository/samples directory and the values you have to change as specified in the prerequisites section are marked with
To build the sample
Start the ESB with the sample 254 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Start the Axis2 server. For instructions on starting the Axis2 server, see Starting the Axis2 server.
Deploy the back-end service SimpleStockQuoteService. For instructions on deploying sample back-end services, see Deploying sample back-end services.
Executing the sample
The sample client used here is the Stock Quote Client, which can operate in several modes. For further details on this sample client and its operation modes, see Stock Quote Client.
To execute the sample client
test.xml file from the
<ESB_HOME>/repository/samples/resources/vfs directory to the location specified in
transport.vfs.FileURI in the configuration (i.e., the in directory).
test.xml file contains a simple stock quote request in XML/SOAP format and is as follows:
Analyzing the output
You will see that the VFS transport listener picks the file from the in directory and sends it to the Axis2 service over HTTP. Then you will see that the request XML file is moved to the original directory and that the response from the Axis2 server is saved to the out directory.