problem in send data through "msxml2.ServerXMLHTTP

Results 1 to 2 of 2

Thread: problem in send data through "msxml2.ServerXMLHTTP

  1. #1
    Join Date
    Dec 1969

    Default problem in send data through "msxml2.ServerXMLHTTP

    I am using the under written code.<BR>I need to send the different data (i.e. sendstring) every time to same url. Every time the server respond back and only then I can send the next sendstring. If I need to send hundereds of sendstring it will take hell lot of time. <BR><BR>My problem is:<BR>How I can send the data without waiting for the response from the I don&#039;t need to collect the result and display as it the last two lines of code.<BR>code is<BR>************<BR><BR>Set objXmlhttp = Server.CreateObject("msxml2.ServerXMLHTTP") <BR> "POST","",false<BR>objXmlHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"<BR>objXmlhttp.send(sendString)<BR>Whil e objXmlHTTP.readyState &#060;&#062; 4 or objXmlhttp.status &#060;&#062; 200<BR>objXmlHTTP.waitForResponse 1 &#039; wait for 1 seconds<BR>Wend<BR>result = objXmlHttp.responseText<BR>Response.Write "&#060;center&#062; result=&#062; " & result<BR>

  2. #2
    Join Date
    Dec 1969

    Default You can't using ASP...

    What you need is the ability to make multiple ASYNCHRONOUS requests. But in order to do that, you have to be able to use a "call back" or "event handler". And neither ASP nor VBScript are set up to allow that.<BR><BR>You would need to code the calls in some language (and platform) that *does* allow callbacks. You can do this with the .NET Framework, though I&#039;m not sure about whether ASP.NET allows it.<BR><BR>Incidentally, you have a bunch of excess baggage in your code.<BR><BR>You should read the docs:<BR><BR><BR>Because your are using FALSE as the third argument to OPEN, the SEND method *will NEVER return until the command is complete!*<BR><BR>So all of this code:<BR> While objXmlHTTP.readyState &#060;&#062; 4 or objXmlhttp.status &#060;&#062; 200<BR> objXmlHTTP.waitForResponse 1 &#039; wait for 1 seconds<BR> Wend<BR>is just a wast of time and code. Because by definition by the time you reach the WHILE the entire operation is complete.<BR><BR>You would use TRUE to make an Asynchronous call. But, as I said, then you would not be able to use a "callback" and would have to resort to the time-wasting WHILE loop you are now using.<BR><BR>So, sorry, but you just have the wrong mix of technologies here.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts