In Dynamics NAV 2013 I am trying run an XMLport from a codeunit that I will execute from a NAS.
The xmlport has been designed to import exchange rates. The source file is hosted on a web server however the problem I get when running the codeunit is that it errors saying it cant find the file. the message in the event viewer is .. The specified path is invalid.
My code is below. Can this actually be done via an xmlport by opening a file hosted on a webserver?
XMLFile.OPEN('http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml');
XMLFile.CREATEINSTREAM(XMLInstreamStream);
XMLPORT.IMPORT(XMLPORT::"Import Exchange Rates",XMLInstreamStream);
XMLFile.CLOSE;
Answers
Use something like WebClient.DownloadFile('http....','c:\.....') and then open the local file.
See: https://msdn.microsoft.com/en-us/library/ez801hhe
However you can always use System.XML to load the data straight from the web.
But this also means you can't use a xmlport to import your data.
Did this exact example a few years ago, wouldnt mind sharing if you want it.