Hi,
Since upgrading from classic 2009 to 2013 I have a problem with a function used to download data directly from a URL.
The codeunit I have created works with httpRequest using the automation 'Microsoft XML, v6.0'.XMLHTTP60.
The code looks like this:
Timeout := 7000;
CREATE(httpRequest,FALSE,TRUE);
httpRequest.open('GET',Link,FALSE);
TimeBegin := TIME;
httpRequest.send();
REPEAT
Elapsed := TIME - TimeBegin;
IF Elapsed >= Timeout THEN BEGIN
CLEAR(httpRequest);
EXIT(FALSE)
END;
UNTIL httpRequest.readyState() = 4;
IF NOT (httpRequest.status = 200) THEN BEGIN
CLEAR(httpRequest);
EXIT(FALSE);
END;
IStream := httpRequest.responseStream(); <- Error here!!!!!
CLEAR(httpRequest);
CLEAR(Response);
Response.READ(IStream);
Actually it is ‘borrowed’ from another post here on Mibuso, and has worked very nicely – until upgrading to 2013
The error I get is the message that NAV cannot convert Microsoft.Dynamics.NAV.Runtime.Automation to Microsoft.Dynamics.NAV.Runtime.NavInstream
I have also tried changing the code utilizing WinHttpRequest instead, but the result is the same.
Any ideas?
Comments
Still would like to know why streaming does not Work in 2013 though :-/
mxh.open('GET',Url+"No.",FALSE);
mxh.send(var_);
var_ := mxh.responseStream;
CLEAR(mxh);
is := var_;
mbt.READ(is);
Picture.CREATEOUTSTREAM(os);
mbt.WRITE(os);