问题描述:

We have a legacy application that is only able to upload files through ftp protocol. Our current application has SOAP interface for similar file submissions. Is there any way to configure the WSO2 ESB to transform the uploaded file through ftp to SOAP request for consuming by our current application?

网友答案:

Yes that is a very common approach. You can create a VFS proxy that is reading from an FTP. You may then make a transformation (depends on the input format) (i.e. XSLT) to fit your SOAP Endpoint and then simply make a <send> to your WS.

Here an example (only pseudo-code - not tested), but will give you a good starting point:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="ftp_proxy_example" transports="vfs" startOnLoad="true" trace="disable">
    <parameter name="transport.PollInterval">10</parameter>
    <parameter name="transport.vfs.FileURI">vfs:ftp://user:[email protected]/path</parameter>
    <parameter name="transport.vfs.FileNamePattern">.*[.]xml</parameter>
    <parameter name="transport.vfs.ContentType">application/xml</parameter>
    <target faultSequence="errorSequence">
        <inSequence>
            <!-- maybe a transformation -->
            <!-- send to your WS endpoint -->
        </inSequence>
    </target>
</proxy>
相关阅读:
Top