18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Failed to create XMLHttpRequest object
I am trying to test webservice using Sahi. I cannot create a XMLHTTPRequest object, hence the code fails. How to create XMLHTTPrequest object in Sahi?
Is it needed to import any classes for this? How it can be done?
My code is like this.
var $url= "http://10.1.5.241/emswebservice/GISWebInterface.asmx";
var $authHeader = "application/x-www-form-urlencoded";
var request = new new XMLHttpRequest();
var XMLdata="<?xml version='1.0' encoding='utf-8'?>"+
"<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"+
"<soap12:Body>"+
"<CheckUserCredentials xmlns='http://tempuri.org/'>"+
"<username>username</username>"+
"<password>passwd</password>"+
"</CheckUserCredentials>"+
"</soap12:Body>"+
"</soap12:Envelope>";
request.open("POST", url, false);
request.setRequestHeader("Content-Type", "text/xml");
request.setRequestHeader("ATH", authHeader);
request.send(XMLdata);
var response = {};
response.statusText=request.statusText;
response.status=request.status;
response.responseText=request.responseText;
Is it needed to import any classes for this? How it can be done?
My code is like this.
var $url= "http://10.1.5.241/emswebservice/GISWebInterface.asmx";
var $authHeader = "application/x-www-form-urlencoded";
var request = new new XMLHttpRequest();
var XMLdata="<?xml version='1.0' encoding='utf-8'?>"+
"<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"+
"<soap12:Body>"+
"<CheckUserCredentials xmlns='http://tempuri.org/'>"+
"<username>username</username>"+
"<password>passwd</password>"+
"</CheckUserCredentials>"+
"</soap12:Body>"+
"</soap12:Envelope>";
request.open("POST", url, false);
request.setRequestHeader("Content-Type", "text/xml");
request.setRequestHeader("ATH", authHeader);
request.send(XMLdata);
var response = {};
response.statusText=request.statusText;
response.status=request.status;
response.responseText=request.responseText;