cancel
Showing results for 
Search instead for 
Did you mean: 

Calling webservices

SOLVED
Highlighted
Contributor

Calling webservices

Hi,

 

w're calling urls in the appserver in the following way:

function verifyUrl(url) {
  var httpObj = Sys.OleObject("MSXML2.ServerXMLHTTP.6.0");
  httpObj.open("GET", url, true);
  httpObj.send();
  while (httpObj.readyState != 4) {
    Delay(500);
    httpObj.send();
  }
  return httpObj.status == 404 ? false: true;
}

 

This worked fine in TC11. In TC 14.0 the test stays in the while loop...Is this approach not supported anymore?

 

sincerely

Paul Vinders

SOPTIM AG

Germany

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Contributor

Re: Calling webservices

The solution is:

 

  httpObj.open("GET", url, false);

 

instead of

 

  httpObj.open("GET", url, true);

 

sincerely

P. Vinders

SOPTIM AG

View solution in original post

4 REPLIES 4
Highlighted
Community Hero

Re: Calling webservices

I'm not sure why that functionality would have changed, but you might look into using the new built in aqHttp scripting objects. We have had better luck using that.


Thanks,
Carson

Click the Accept as Solution button if my answer has helped
Community Hero

Re: Calling webservices

Hi,

 

If I am not mistaken, httpObj.readyState can return either a number or text value. ('complete' in your case)

Try to put a breakpoint on the Delay() line and inspect the value of the httpObj.readyState property.

 

P.S. BTW, it is not needed to resend the request within the while loop because:

a) you are issuing request synchronously (httpObj.open("GET", url, false); ) which means that .open() will not return until the response is received; and

b) .send() within the loop will create not necessary significant load on the web server if the response is not received within 500ms (as per your code) and request is sent asynchronously (httpObj.open("GET", url, true); ).

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Manager

Re: Calling webservices

Thank you Alex, cunderw. 

Hi @paulvinders , did you find a way to solve this? Please share your progress with us! 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Contributor

Re: Calling webservices

The solution is:

 

  httpObj.open("GET", url, false);

 

instead of

 

  httpObj.open("GET", url, true);

 

sincerely

P. Vinders

SOPTIM AG

View solution in original post

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!

Challenge Status

Changing options from outside of TestComplete

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!

Comparing content of HTML table with Excel file data

Participate!

Compare HTML table with Excel file and correct data in the file

Participate!