I want to read multiple comma delimiter file from ftp server and insert data into ax regular table
i am trying this but i did not got any result.
please provide the X++ code for the same
I want to read multiple comma delimiter file from ftp server and insert data into ax regular table
i am trying this but i did not got any result.
please provide the X++ code for the same
It sounds like GetResponse throws an exception, but you're not aware of it, because you forget to catch it. And you can't fix the problem without finding out what it is.
Do the following; it should show the message from the exception (unless yoi call the code inside a transaction).
try { ftpWebResponse = ftpWebRequest.GetResponse(); } catch (Exception::CLRError) { throw error(AifUtil::getClrErrorMessage()); }
By the way, please always use Insert > Insert Code (in the rich-formatting view). Unlike your code above, it preserves indentation, making code much easier to read.
Yes i am able to access the ftp server from the location where Ax is running
code
//in the code i am not getting response, refer the comment.
private void getFTPDirFilesList()
{
container conFTPFilesDownload;
ListIterator ftpFilesListIterator;
// Marshaling .NET to X++
ftpObject = System.Net.WebRequest::Create(ftpHostName);
ftpWebRequest = ftpObject;
if (ftpWebRequest)
{
ftpWebRequest.set_KeepAlive(false);
ftpWebRequest.set_UsePassive(true);
ftpWebRequest.set_UseBinary(true);
ftpWebRequest.set_Timeout(ftpTimeOut);
ftpWebRequest.set_Method(#ListDirectory);
this.setFTPCredentials();
ftpWebResponse = ftpWebRequest.GetResponse();
if (ftpWebResponse)
{
ftpFilesList = new list(Types::String);
// BP Deviation Documented
ioStreamReader = new System.IO.StreamReader(ftpWebResponse.GetResponseStream());
if (ioStreamReader)
{
strReadLine = ioStreamReader.ReadLine();
while (!System.String::IsNullOrEmpty(strReadLine))
{
ftpFilesListIterator = new Listiterator(strsplit(strReadLine,
'/'
));
while (ftpFilesListIterator.more())
{
conFTPFilesDownload += ftpFilesListIterator.value();
ftpFilesListIterator.next();
}
ftpFilesList.addEnd(conPeek(conFTPFilesDownload, conlen(conFTPFilesDownload)));
strReadLine = ioStreamReader.ReadLine();
}
ioStreamReader.Close();
}
if (ftpFilesList.empty())
{
warning (strfmt("No files available in %
1
", ftpHostName));
}
}
}
}
Can you access the FTP server from the location where AX runs? You can try to access it via a web browser. Perhaps some firewall is blocking the access.
In general, may I suggest that you share as much details about your situation as possible? This would help us to help you figure out what the problem could be, and hopefully solve the problem. The quality of the help that you will get is strongly linked to the quality of information that you share.
i tried
still didn't got response from ftp server.
how i will run this code in ax 2012
www.atomicax.com/.../downloading-files-ftp-and-doing-something-them-d365fo
i tried using this daxbalakumaran.wordpress.com/.../
still having issue.
i am not getting any response from ftp server
Hi M.G.Harran,
Maybe these are helpful to you:
daxbalakumaran.wordpress.com/.../
www.atomicax.com/.../downloading-files-ftp-and-doing-something-them-d365fo
Yes
1. i am not able get file from ftp folder.
please provide the X++ code for the same
Decompose the problem to individual pieces:
Then think about what you know how to do and what you don't. For example, maybe you know how to insert data, but you don't know how to work with FTP.
When you understand what actually need, you can use a search engine to find documentation, blog posts and forums threads on the right topic. If you don't find what you need, create a new thread (with an approriate name and tags) and explain your particular problem.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,280 Super User 2024 Season 2
Martin Dráb 230,214 Most Valuable Professional
nmaenpaa 101,156