0

I want to add a service in WSO2, this service is mainly used to scan file on remote ftp servers and tells client the file name.

The process is as follows: Services scheduled scanning ftp direction, if found matching files, then send file name to client(sendReportFile(fileName)).

How to do this in wso2?

I think I need use vfs for scan file, but how to send file name to client?

Chathura Wijeweera
  • 289
  • 1
  • 2
  • 9
luohao
  • 135
  • 2
  • 14

2 Answers2

3

If you use vfs as transport, the filename of the picked up file is available as a transport property named FILE_NAME. The filename and complete path is available as transport property FILE_PATH.

So you can use the get-property() XPath function to get the value, either using

get-property('transport', 'FILE_NAME')

or

get-property('$trp:FILE_NAME')

erikl
  • 41
  • 3
0

If you need to handle this without downloading the actual file (which is the case with VFS), you might use a custom or class mediator to connect to the FTP server at given poll time. An example of creating custom mediator: http://maninda.blogspot.co.uk/2013/01/writing-custom-mediator-for-wso2-esb_7.html

The Apache Commons FTPClient class which comes integrated can be used to interact with the FTP server from within the mediator: http://commons.apache.org/proper/commons-net//apidocs/org/apache/commons/net/ftp/FTPClient.html

mifanc
  • 16
  • I think it will be great if you can post in some relevant code snippets as well from the links you posted – RinoTom Sep 24 '13 at 14:55