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
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
Highlighted
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 Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
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

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
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