This documentation is for WSO2 Enterprise Service Bus version 4.7.0 . View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Objective: Using vfs transport to access a windows share.

Code Block
languagehtml/xml
<!-- Using the vfs transport to access a windows share -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
    <proxy name="StockQuoteProxy" transports="vfs">
		<parameter name="transport.vfs.FileURI">smb://host/test/in</parameter> <!--CHANGE-->
        <parameter name="transport.vfs.ContentType">text/xml</parameter>
        <parameter name="transport.vfs.FileNamePattern">.*\.xml</parameter>
        <parameter name="transport.PollInterval">15</parameter>
		<parameter name="transport.vfs.MoveAfterProcess">smb://host/test/original</parameter> <!--CHANGE-->
		<parameter name="transport.vfs.MoveAfterFailure">smb://host/test/original</parameter> <!--CHANGE-->
        <parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
        <parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>

        <target>
            <endpoint>
                <address format="soap12" uri="http://localhost:9000/services/SimpleStockQuoteService"/>
            </endpoint>
            <outSequence>
                <property name="transport.vfs.ReplyFileName"
                          expression="fn:concat(fn:substring-after(get-property('MessageID'), 'urn:uuid:'), '.xml')" scope="transport"/>
                <property action="set" name="OUT_ONLY" value="true"/>
                <send>
                    <endpoint>
						<address uri="vfs:smb://host/test/out"/> <!--CHANGE-->
                    </endpoint>
                </send>
            </outSequence>
        </target>
        <publishWSDL uri="file:repository/samples/resources/proxy/sample_proxy_1.wsdl"/>
    </proxy>
</definitions>

1. You will need access a windows shared folder. Just create a folder(called 'test') on a windows machine and create three sub folders in, out and original inside that folder.Then assign the permission to the network users to read and write into the root 'test' folder and the folders inside that directory.

2. Open ESB_HOME/repository/samples/synapse_sample_265.xml and edit the following values. Change transport.vfs.FileURI, transport.vfs.MoveAfterProcess, transport.vfs.MoveAfterFailure parameter values to the above in, original, original directories respectively. Change outSequence endpoint address uri to out directory with the prefix vfs:. Values you have to change are marked with <!--CHANGE-->.

3. Copy ESB_HOME/repository/samples/resources/vfs/test.xml to the directory given in transport.vfs.FileURI above.

4. Start the Axis2 server and deploy the SimpleStockQuoteService if not already done

5. Enable vfs transport receiver and the vfs transport sender in the ESB axis2.xml. Just uncomment the VFSTransportListener and the VFSTransportSender in axis2.xml

6. Start the Synapse configuration numbered 265: i.e. wso2esb-samples -sn 265

7. VFS transport listener will pick the file from in directory and send it to the Axis2 service. The request XML file will be moved to original directory. The response from the Axis2 server will be saved to out directory.