Forum Discussion

nishay_patel's avatar
nishay_patel
Occasional Contributor
11 years ago

ActiveX Objects are caching HttpRequests (SOAP Requests in JScript)

I am sending  a SOAP request in JScript using 



var temp = new ActiveXObject("MSXML2.XMLHTTP.3.0")

temp.open("POST", wsdlURL, false)

temp.send(env)



Now this worked the first time, but it seems to have cached the response, and now I get the same response over and over again.  The soap request requires some credentials to be in the soap header, but even if I do not include them, I get the same response back.



Is there some way to stop the caching from my end or is something that has to be handled server-side?  I looked at some option that allows cache-control to be set in the soap header, but this is illegal in ActiveXObjects (? getting a syntax error).



Some side notes:  


  • I need to be sending the httprequests in my script and cannot have the webservice url stored in WebServices collection (my testsuite requires that the domain of the wsdl need be changed -- same web service, 9 different domains)


  • I have a set credentials that need to be added to the soap header, which I am doing using a subroutine (not using GeneralEvents for other reasons).  I also added a nonce to the header, but that doesnt seem to make a difference in whether I get a fresh response or not.


  • So the "envelope" that I send via ActiveXObject is a complete SOAP request xml in String format.


When I run this same envelope through SOAPUI, I get a non-cached, correct response back.  My issue lies in using JScript and ActiveX.  I need some kind of way to avoid caching.



Thanks in advance.

1 Reply

  • nishay_patel's avatar
    nishay_patel
    Occasional Contributor
    Okay I figured this one out.   A randomized string needs to be present, but not in the envelope header as I thought.



    Instead, do this:



    XmlHttpRequest.open("POST", wsdl + "&(new Date()).getTime()", false);



    append the random string (in this case the timestamp) to the wsdl url in the open call.