Forum Discussion

chicks's avatar
chicks
Regular Contributor
13 years ago

XML HTTP request fails, CURL works

At the suggestion of another member of this forum ( thanks Nick!) I have been successfully testing restful web services by using the xml http object to form my web service requests.

 

i.e.         var XmlHttpRequest = new ActiveXObject("MSXML2.XMLHTTP.3.0");

 

To help in manual debugging, I am creating the associated CURL requests for the web services. 



Last week some of  the XmlHttpRequest started returning errors on the parameters for invalid values.   However, the associated curl requests still work.  The behavior seems like  all the parameters are not being properly received when using the XML HTTP request.



I have not changed my code. (The same scripts are workiing in in our staging and production environments.)  The developers claim they have not changed their code.



Has anybody seen anything similar or have any theories?



6 Replies

  • chicks's avatar
    chicks
    Regular Contributor


    Briefly:   dev had removed the json-lib-2.3-jdk1.5 jar from the build.  replacing it fixed the problem.



    Lengthy:  we determined by using a debugger and setting breakpoints that extra characters WERE  being received in the json object.   checking the revision history for the library files showed that a change had been made. 



    Curiously the change log for the new verions of json-lib shows that changes were made to fix iincorrect  string parsing. http://json-lib.sourceforge.net/changes-report.html#a2.4 

    Looks like those changes broke some other stuff. It looks like they need to enhance their automated regression testing!



    Thanks all for the suggestions!  Regards.
  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Hu Curt,



    Great to hear that you succeeded with CURL testing! I remember your original thread and now I am confident in one more thing that can be done using TestComplete. :)



    > Has anybody seen anything similar or have any theories?

    Just a piece of theory, sorry: What about updates installed possibly by Windows Update? As your code uses MSXML as a basic driver and MS updates this component quite often, there are the  chances that one of the latest updates could broke something.

    Have you considered to check what updates were installed on the given box since the last successful tests execution, what these updates were about and try to rollback the ones that look to be relevant to the MSXML component?

  • Install something like fiddler and see if the requests being generated differ between TestComplete and curl.



    I'd be wary of developers claiming they haven't changed anything...
  • chicks's avatar
    chicks
    Regular Contributor
    Thanks Alex,   great suggestion!   I had considered that the MS updates may have affected my use of the object, but discounted it since my code was still working with the staging and production environment.  However,  your suggestion makes me wonder what version of the ActiveXObject the receiving code is using.  In any event, I'll check both and report back.
  • AlexKaras's avatar
    AlexKaras
    Community Hero
    Nick's suggestion is also very reasonable as it will let you know what exactly went out to the wire from TestComplete and what response was obtained.

    BTW, you may consider installing Fiddler (or WireShark) not only on TestComplete's end, but on the box where receiving end is, so you can capture what arrives to and goes out from there.
  • chicks's avatar
    chicks
    Regular Contributor
    I checked with one of the developers.  He says that they receive the request as an http request whether it's transported by curl or an activeXobject and don't even use the MS objects.  So my theory about that seems less likely though I still need to confirm what framework if any they are using to handle the http requests.



    I have downloaded Fiddler and attempted to have it intercept the request but have not yet succeeded.     My understanding is that wireshark cannot deal with HTTPS, is that correct? 



    Thanks all.