Options

Problem with .NET XMLHTTPREQUEST

EurgArotEurgArot Member Posts: 2
Hi everyone,
i have a problem with this script to make an api call (Get) to the google maps web service. In this way it releases me a status other than 200. Through this script i would like the responce to be loaded in an xml witch i then pass to functions that decode and populate fields in the table. Thank you in advance, I await your answers.
The endpoint is correct because i run this api with other software and get status = 200 and release the xml.

The code of the script is this:

Variable :

DotNetXmlHttp=
MSXML.XMLHTTPRequestClass.'Microsoft.MSXML, Version=8.0.0.0, Culture=neutral
XMLResponseDoc =
System.Xml.XmlDocument.'System.Xml, Version=4.0.0.0, Culture=neutral

Procedure:

IF ISNULL(DotNetXmlHttp) THEN
DotNetXmlHttp := DotNetXmlHttp.XMLHTTPRequestClass;

DotNetXmlHttp.open('GET',ENDPOINT,0,'','');

DotNetXmlHttp.setRequestHeader('ProxyServer','<CURRENT_USER>');
DotNetXmlHttp.setRequestHeader('Timeout','30000');

XMLResponseDoc := XMLResponseDoc.XmlDocument();

IF DotNetXmlHttp.status = 200 THEN

Answers

  • Options
    JavaidJavaid Member Posts: 23
    Try this:

    URL = Endpoint
    XMLHTTP = Microsoft XML, v3.0.XMLHTTP
    XMLDoc = Microftsoft XML, v.6.0.DOMDocument60


    CLEAR(XMLHTTP);
    CLEAR(XMLDoc);

    CREATE(XMLHTTP);
    CREATE(XMLDoc);

    XMLHTTP.open('Get', URL, FALSE);
    XMLHTTP.send(XMLString);
    XMLDoc.load(XMLHTTP.responseBody);

    FileName := 'c:\Temp\XMLFile_' + DELCHR(FORMAT(TODAY),'=','-') + DELCHR(FORMAT(TIME),'=',':') +'.xml';
    XMLDoc.save(FileName);
Sign In or Register to comment.