Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Problem with httpRequest and WinhttpRequest after upgrading

$
0
0
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?

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>