Forum Discussion
VasilyM
13 years agoNew Contributor
Alexei,
Thank you, your post was very useful for me.
I wrote the function based on post http://smartbear.com/forums/f81/t65754/testing-curl-webservices to send the request to REST Web Service. Here's the code:
function send (objJSON) {
var XmlHttpRequest = Sys["OleObject"]("MSXML2.ServerXMLHTTP");
var method = "POST";
var URL = "http://192.168.125.27:8000/GetRows";
XmlHttpRequest.open(method, URL, false);
XmlHttpRequest.setRequestHeader("Content-Type", "json");
XmlHttpRequest.send(objJSON);
//XmlHttpRequest.responseText returns JSON object
try {
return XmlHttpRequest.responseText;
}
catch (e) {
return "Error" + e;
}
}
ActiveXObject("MSXML2.XMLHTTP.3.0"); and Sys["OleObject"]("MSXML2.XMLHTTP.3.0"); did not work, the TC said "The system cannot locate the resource specified." (msxml3.dll). I found topic about this issue and it works great for me:
http://p2p.wrox.com/classic-asp-xml/8761-msxml3-dll-0x800c0005-he-system-cannot-locate-2.html
I send the JSON object as a string in the body of the send() method:
objJSON = "{\"query\":\"select * from customer\"}"
And here I found that testcomplete can operate with the JSON objects by very simple way:
http://mindcemetery.wordpress.com/2009/10/19/json-in-testcomplete/
Note: I use testcomplete 7.52
Thank you, your post was very useful for me.
I wrote the function based on post http://smartbear.com/forums/f81/t65754/testing-curl-webservices to send the request to REST Web Service. Here's the code:
function send (objJSON) {
var XmlHttpRequest = Sys["OleObject"]("MSXML2.ServerXMLHTTP");
var method = "POST";
var URL = "http://192.168.125.27:8000/GetRows";
XmlHttpRequest.open(method, URL, false);
XmlHttpRequest.setRequestHeader("Content-Type", "json");
XmlHttpRequest.send(objJSON);
//XmlHttpRequest.responseText returns JSON object
try {
return XmlHttpRequest.responseText;
}
catch (e) {
return "Error" + e;
}
}
ActiveXObject("MSXML2.XMLHTTP.3.0"); and Sys["OleObject"]("MSXML2.XMLHTTP.3.0"); did not work, the TC said "The system cannot locate the resource specified." (msxml3.dll). I found topic about this issue and it works great for me:
http://p2p.wrox.com/classic-asp-xml/8761-msxml3-dll-0x800c0005-he-system-cannot-locate-2.html
I send the JSON object as a string in the body of the send() method:
objJSON = "{\"query\":\"select * from customer\"}"
And here I found that testcomplete can operate with the JSON objects by very simple way:
http://mindcemetery.wordpress.com/2009/10/19/json-in-testcomplete/
Note: I use testcomplete 7.52
Related Content
- 2 years agoAnonymous
- 7 years ago
- 3 years ago
Recent Discussions
- 2 days ago
- 2 days ago
- 5 days ago