Forum Discussion
nishay_patel
11 years agoOccasional Contributor
Thanks for the reply. My goal is to not have the webservice stored in TestComplete, rather just post the soap envelope directly through my script. parseResponse works perfectly when no portion of the returned object is an array, but it appears the array returned is a generic object has cannot be distinguished from a child object.
Anyway, I used a brute force method to use to regexp on the returned XML from the XmlHttpRequest post.
var XmlHttpRequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");
XmlHttpRequest.open("POST", wsdl, false);
XmlHttpRequest.send(test); //test is the soap envelope in xml format (actually just a string with its content)
//parse the response
var ResponseXml = XmlHttpRequest.responseXML;
var re = new RegExp("Blah(.*)Blah", "g");
var match;
var results = new Array();
while (match = re.exec(ResponseXml.xml)) {
results.push(match[1]);
}
return results;
This will take the reponse given in XML format and read all of the matches of that regexp type and push it onto a single array.
Thanks again for the response!
Anyway, I used a brute force method to use to regexp on the returned XML from the XmlHttpRequest post.
var XmlHttpRequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");
XmlHttpRequest.open("POST", wsdl, false);
XmlHttpRequest.send(test); //test is the soap envelope in xml format (actually just a string with its content)
//parse the response
var ResponseXml = XmlHttpRequest.responseXML;
var re = new RegExp("Blah(.*)Blah", "g");
var match;
var results = new Array();
while (match = re.exec(ResponseXml.xml)) {
results.push(match[1]);
}
return results;
This will take the reponse given in XML format and read all of the matches of that regexp type and push it onto a single array.
Thanks again for the response!
Related Content
Recent Discussions
- 18 hours agodhundley