Showing posts with label WinInet. Show all posts
Showing posts with label WinInet. Show all posts

Thursday, May 14, 2009

Reading a webpage with Axapta

There seems to be no limit to what you can do with Microsoft Dynamics Ax, aka Axapta. For instance, reading a webpage.
In the old days (version 3), this was possible using the WinInet class.
In Ax 2009, just use CLR interop (common language runtime interoperability).
For example:

static void WebClient(Args _args)
{
System.Net.WebClient myWebClient;
System.IO.Stream myStream;
System.IO.StreamReader myStreamReader;
str content;
str myURL="http://www.microsoft.com/dynamics/ax/default.mspx";
;
myWebClient = new System.Net.WebClient();
myStream=myWebClient.OpenRead(myURL);

myStreamReader = new System.IO.StreamReader(myStream);
content=myStreamReader.ReadToEnd();

info(content);
}

This is just a small example to get you started, start building on this base.


Greetings,


Willy.