Apu_Shah
asked on
ASP.NET webservice - Connect to FTP Web server - Read Text file.
EE Team,
I have a project design, wherein i need to develop a asp.net web service application, this application will constantly look in to a FTP Server.
So other application will place a text file on to the Secure FTP Server, and my webservice will look for this text file, if the text file is found, it will read this file and update some table.
The problem here is what kind of programming method should i use, please give me some examples..from web....
1. Web service to connect to FTP Server.
2. How the web service will know, if there is any text file in the folder.
3. How to read the text file.
Please let me know you thought or sample example how can i acheive this design.
Thanks
I have a project design, wherein i need to develop a asp.net web service application, this application will constantly look in to a FTP Server.
So other application will place a text file on to the Secure FTP Server, and my webservice will look for this text file, if the text file is found, it will read this file and update some table.
The problem here is what kind of programming method should i use, please give me some examples..from web....
1. Web service to connect to FTP Server.
2. How the web service will know, if there is any text file in the folder.
3. How to read the text file.
Please let me know you thought or sample example how can i acheive this design.
Thanks
ASKER
I looked at this code, i think it will work as expected.
I had one more question : The design says " Webservice will always loop and look for a one text file. if the file is found continue read the file and process " I am not sure how will this code make sure to loop and look for the file and once the file is arrived at the ftp server - folder location. process it.
I am going to try this, also i need help or sample code - to read a tab delimited text files.
Thanks.
I had one more question : The design says " Webservice will always loop and look for a one text file. if the file is found continue read the file and process " I am not sure how will this code make sure to loop and look for the file and once the file is arrived at the ftp server - folder location. process it.
I am going to try this, also i need help or sample code - to read a tab delimited text files.
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
pinaldave - I don't mean to be a pointwhore, but I think my responses answered his question...
http://www.csharphelp.com/archives/archive9.html
Copy the first class into FTPFactory.cs
Then in your webservice method, do something like the following
FTPFactory ff = new FTPFactory();
ff.setRemoteHost("192.168.
ff.setRemoteUser("username
ff.setRemotePass("password
ff.login();
ff.chdir("/dir");
// Check if file exists
String[] fileNames = ff.getFileList("filename.t
if (fileNames==null || fileNames.Length!=1) {
// File not found
return;
}
// File is there, download it
ff.setBinaryMode(true);
ff.download("filename.txt"
// Remove it??
ff.deleteRemoteFile("filen
ff.close();
DoSomethingWithFile();