How do you do this with .NET assemblies (wget)

Hi' all.

I am looking for a way to achieve the same result in NAV 2013 as this piece of code from NAV 2009R2.

The Function in question is a 'wget' that returns the output of a HTTP request into a bigtext variable.
XMLHttp [Automation] -- 'Microsoft XML, v4.0'.XMLHTTP40	
TimeElapsed [Integer]
ReadyState [Option] -- Optionstring="uninitialized,open,sent,receiving,loaded"
TimeBegin [Time]
BigText [BigText]
InStream [InStream]
Variant [Variant]
CREATE(XMLHttp);
XMLHttp.open('GET','www.somewebsite.com', FALSE);
XMLHttp.send();

TimeBegin := TIME;
REPEAT
  TimeElapsed := TIME - TimeBegin;
  ReadyState := XMLHttp.readyState;
UNTIL (ReadyState = 4) OR (TimeElapsed > 45000);

IF (XMLHttp.status = 200) AND (XMLHttp.statusText = 'OK') THEN
  IF ReadyState = 4 THEN BEGIN
    CLEAR(Variant);
    Variant := XMLHttp.responseStream;
    InStream := Variant;
    BigText.READ(InStream);
  END;

CLEAR(XMLHttp);
regards/tkr

Best Answer

Answers

Sign In or Register to comment.