#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2017
    Posts
    3
    Rep Power
    0

    ServerXMLHTTP returning the same responseText with simultaneous requests


    Hello,

    It's the first time I post something in a forum (although I check them all the time), so I hope I explain myself right.

    I'm stuck in a problem with ServerXMLHTTP.

    When there's just one individual request, it returns the expected result. But if they happen at the same time, responseText returns for the slowest one the same result as the faster simultaneous one.

    It's been reported by the users, but I tested it running the pages on two different browsers in my pc. I trigger one request and immediately I click on a different one on a different instance of the browser or a different browser.

    Here is my code:

    Set xmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP")
    On Error Resume Next
    xmlHttp.Open "GET", "http://someserver/somepath/?somequerystring" , False
    xmlHttp.setOption 2, 13056 'ignore all SSL Cert issues
    If Err Then 'handle errors
    Response.Write(Err.Description & " [0x" & Hex(Err.Number) & "]<BR><BR>")
    Response.End
    End If
    On Error Goto 0
    xmlHttp.setRequestHeader "User-Agent", "asp httprequest"
    xmlHttp.setRequestHeader "Content-Type", "text/json"
    xmlHttp.Send
    resultatJSON = xmlHttp.responseText
    xmlHttp.abort()
    set xmlHttp = Nothing

    Hope my explanation was clear. And sorry if I misused some term, English is not my mother tongue.

    Many thanks in advance!!
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,553
    Rep Power
    4549
    I'd start by taking out the On Error Resume Next, perhaps you're masking some error condition and allowing your code to continue anyway.
    ======
    Doug G
    ======
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2017
    Posts
    3
    Rep Power
    0
    Thank you very much for your response, Doug

    I did as you suggested and it throws the msxml3.dll error '80072f78' (The server returned an invalid or unrecognized response). It only happens with the requests are concurrent. Otherwise, it all works fine.
    Is it possible that there might be some issue in the configuration of the server?

    Thanks again!!

    Originally Posted by Doug G
    I'd start by taking out the On Error Resume Next, perhaps you're masking some error condition and allowing your code to continue anyway.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2017
    Posts
    3
    Rep Power
    0
    Not sure my previous answer was submitted, since I left the pc for a while and the session was closed.

    I would like to update it anyway.

    First, thank you very much for your response, Doug! So much appreciated.

    I did as you suggested and it threw the msxml3.dll error '80072f78' (The server returned an invalid or unrecognized response). I thought it was a general thing but it's not. It happens when running the same script simultaneously in 2 different instances.

    I've run some test so if it can be of any help.

    script 1:
    resultat = resultatJSON(param) (and resultatJSON is a VBscript function)

    script 2:
    resultat = resultatJSON2(param) (and resultatJSON2 is a Jscript function, runat server)
    Code:
    function resultatJSON2(qstring) {
    	var xmlHttp2;
    	xmlHttp2 = Server.CreateObject ("MSXML2.ServerXMLHTTP");
    	xmlHttp2.open ("GET", "http://someserver/" + qstring, false);
    	xmlHttp2.send ();
    	response.write(qstring + "<br>" + xmlHttp2.responseText);
    	return xmlHttp2.responseText;
    }
    First I thought that maybe the interference was via variable, but what drives me crazy is that the response.write straight from the Jscript returns the same value as the request running on the 2nd simultaneous instance. Ah, the parameters (querystring) are correct. The query is executed and it gives it correctly (I know it cause it's serial numbers, so if I check the previous one, that's the one!), but the xmlHttp2.responseText is not returning it right.

    I did this duplicating the functions in this weird way just as a test and to try to find a way to explain it in a clear way. I hope i achieved it. If it's not clear at all or too specific, I'll understand if it's all left here.

    Thank you very much!!




    Originally Posted by Doug G
    I'd start by taking out the On Error Resume Next, perhaps you're masking some error condition and allowing your code to continue anyway.
  8. #5
  9. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,553
    Rep Power
    4549
    I haven't done asp for a decade or so, but it seems to me there should be some onPageReady or similar event to help with multiple requests. But I really don't know, I only did very limited ajax stuff with asp and the memory cells are fading.
    ======
    Doug G
    ======
    I've never been able to appreciate the sublime arrogance of folks who feel they were put on earth just to save other folks from themselves .." - Donald Hamilton
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2014
    Posts
    45
    Rep Power
    4
    To further help you about this issue, I am trying to invoke someone experienced to help look into this thread, this may take some time and as soon as we get any result, we will post back.

IMN logo majestic logo threadwatch logo seochat tools logo