Changing remove directory of ftp to poll using spring integration ftp - spring

I'm developing an app which downloads the files from ftp server. However the ftp folder may differ during each run. The ftp folder to be polled is provided by the user.
I noticed the spring documentation mentions remote-directory-expression use but I'm not sure how can I use this for the parameters supplied by a user.
Inputs please.

The expression can reference any bean via #someBean.someMethod().
You might find it easier, however, to use the FTP outbound gateway to get specific files.

Related

SFTP transport as business service - how to dynamically change the destination folder?

I have a service bus project (on 12.2.1.0.0) in JDeveloper which polls file via SFTP transport (proxy service) and depending on file extension process should place it in directory1 or directory2. I have actually now configured SFTP transport also as business service however I am unable to find in documentation or in OSB a configuration for passing this dynamically changing output directory. I know I could use FTP adapter on weblogic, but that's "not" an option here due to the fact I do not have access to that weblogic and can not create it.
Any ideas?
Thanks a lot
Since the target directory is hardcoded in the URL, your only option, as far as I can tell, is to have 2 Biz services - each with its own directory in URL - and dynamically route to one or another based on your criteria.

FTPS in Spring or Applet

I have a requirement to provide Secure-File-Upload file feature as a new service in my existing application. Expected Upload file size would be huge like over 100MB. If I do plugin-in such feature into my application it will surely die.
At the same time I need to provide or launch that service only through my current application, anyhow I need to achieve it without affecting my current application at any cost.
I am thinking of two solutions in mind, request others advise
Develop a small file uploader web app, host it in a seperate web/app severs,
launch it from my current application through some link. (I can not ask user to login into another new url)
Render an Applet to achieve secure file transfer service (in this point I am not clear whether the applet can directly talk to SFTP server without hindering
my current app's server components)
Further, I am referring to Spring Integration docs with FTP server.
I wonder Can a spring controller receive stream from client via FTPS connection and immediately transfer to FTP server without having to store it in local file.
Please advise your views.
Thanks&Regards,
Sabari

Camel FTP Fails to retrieve files based on the include filter

I am using Apache camel 2.13.2 and am trying to connect to an FTP to retrieve files based on the file expression given in the include parameter. I can see that there are files in the folder in the ftp account, but camel doesn't pull the files. I can see in the log that the connection is successful, but the exchange is returned as null. The same code works for other ftp accounts. Could someone help to understand on where I am doing wrong, and things that I could try to get this fixed?
ftp://XXXXXXX#XXXXXXX.XXXXXXX.XXX:21/testfolder/testfold/test?password=RAW(XXXXXXX)&binary=true&pollStrategy=#xxxFTPPollingConsumerPollStrategy&throwExceptionOnConnectFailed=true&sendEmptyMessageWhenIdle=true&delay=15000&maxMessagesPerPoll=30&stepwise=false&consumer.bridgeErrorHandler=true&idempotent=true&idempotentKey=${file:name}-${file:size}-${file:modified}&readLock=changed&include=.*
first try without any filters to see if it is the problem.
In any case, depending on the server and client firewalls and linux vs windows encoding (for the file transfer) you should give a try to the following URI parameters:
binary=true
passiveMode=true
most of the times with the default passiveMode camel wont list any file and file transfer may fail with an ArrayOutOfBounds error.
To double check set the logging level of camel to debug and to trace for the ftp component:
logging.level.org.apache.camel=DEBUG
logging.level.org.apache.camel.component=TRACE
without passiveMode=true you will likely notice that the list file doesn't find any file.
more info about the FTP passive mode can be found here

Connect salesforce to ftp using http request

I want to connect my salesforce account to an FTP server so that I do not have to use the local system for the storage of any files coming from FTP. I have tried connecting to the FTP server using CLI which I have done successfully as I can see the files coming from the FTP.
Can somebody explain how i ccould connect the ftp server to my salesforce account using an http request and also how could i transfer and use the .Csv file to update/import the data into the salesforce custom object**
There are many methods to import data into Salesforce, however, FTP to Salesforce isn't one of them. I would either use the Salesforce Data Loader, if you have access to this data at the console, or use the Salesforce API for whatever platform you program in, to create a program that uses your FTP and can parse your data and deliver it to Salesforce through the API.
You're not going to be able to do this directly. You might look at using an intermediary system like TIBCO or Informatica. SFDC specifically prohibits FTP access.
Using your staging system, have it kick off an Apex bulk API job to do the import. You could do it with a cheap cloud server running your FTP box and a script that kicks off when a file is created in the specified directory, and then when the API job is done, archive or delete the original file and log files.

FTP on Wso2 ESB

I have a .Net web application that is front-ending the ESB in order to create Proxies programmatically.
I am trying to push a xml proxy into the ESB path: repository/deployment/server/synapse-configs/default/proxy-services/ via FTP but it seems not to work.
I was trying this connection: ftp://admin:admin#localhost:9443/repository/deployment/server/synapse-configs/default/proxy-services/
There is any other way to upload my XML in the ESB? many thanks
EDIT: I know that one answer could be "yes, you can do that by using admin services", but that didn't work for me due to lack of documentation regarding adding proxies via admin services. So I am looking at alternatives like FTP, because I know that placing the xml directly in the Repo folder will work, the problem is accessing the folder.
As I understand, you are trying to use FTP to upload a file to a path. This doesn't involve invoking WSO2 ESB, does it?
Based on above understanding, it seems your port specified in FTP address is incorrect. I think you should use the port of the FTP server you are running in your machine. Unless you haven't edit its config, it should be 21. After this change, you need to provide absolute path instead of relative path /repository/...
Think about it as just another FTP upload. ESB automatically deploy any file that comes to /repository/deployment/server/synapse-configs/default/proxy-services/ regardless of how it came there.
Hope this helps!
I was looking for a proper way to add a proxy to the ESB, possibly using ws-admin services, but that wasn't really straightforward: problem with repositories, libraries etc...
I ended up with a quick a dirty solution: secure java ftp to the server (with jsch )in the proper folder of the proxies.
Thanks for your help anyway
You could create your proxy within the Web Interface of WSO2 (use a Web Browser):
localhost:9443/carbon/admin/login.jsp
Or add the proxy by just copying the file
mv myProxy.xml MY_WSO2/repository/deployment/server/synapse-configs/default/proxy-services/myProxy.xml
An FTP connection to localhost:9443 will not work. Otherwise explain why you need to use FTP?

Resources