// Retrieves reservations information from FACILITOR for use in Sentido.
// Copyright 2013 SG|facilitor. 053-4800 700,  support@sgfacilitor.nl

var xmlfilename = "FCLT.xml"
var xmlUrl = "https://nybu.facilitor.nl/?API=SENTIDO&APIKEY=LiWkj3o3n58nELNe";
var xmlBody = "<GetReserveringen/>";

//// NO CHANGES REQUIRED BELOW THIS LINE ///////////////////////////////////////

var flog;
var xmlResp;

flog = new ActiveXObject("ADODB.Stream")
flog.Open;
flog.Type = 1; //adTypeBinary

var xmlhttp = new ActiveXObject("WinHTTP.WinHTTPRequest.5.1");
SXH_PROXY_SET_PROXY = 2
//xmlhttp.setProxy(SXH_PROXY_SET_PROXY, "127.0.0.1:8888"); // Voor debugging met Fiddler
xmlhttp.open("POST", xmlUrl, false);
xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=utf-8")

var msg = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
        + "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"
        + "  <soap:Body>"
        + xmlBody
        + "  </soap:Body>"
        + "</soap:Envelope>";

xmlhttp.send(msg);

WScript.Echo("Status: "+xmlhttp.status);

flog.Write(xmlhttp.responseBody);
flog.SaveToFile(xmlfilename, 2);

WScript.Echo("Klaar met wegschrijven")