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.
Thursday, May 14, 2009
Subscribe to:
Post Comments (Atom)
I work with 3.0, so can you also provide a simple example to show a webpage in 3.0??
ReplyDeleteThanks.
C
Hi C,
ReplyDeleteIn version 3, you can use the WinInet Class. Like this:
static void WebSiteRead(Args _args)
{
WinInet inet = new WinInet();
int hdl;
str content;
BinaryIO _io;
;
hdl = inet.internetOpenUrl('http://www.google.com');
content = inet.internetReadFile(hdl);
_io = new BinaryIO('c:\\test.txt', 'W');
_io.write(content);
inet.internetCloseHandle(hdl);
}
For showing a webpage in an Axapta form, you can use an ActiveX control, like Microsoft Web Browser. Mail me if you need an example.