newuser11
asked on
MSXML2.ServerXMLHTTP
Hi,
I am using MSXML2.ServerXMLHTTP to access a web page which is located on my machine(localhost). During the "Send" I get the following error. Any thoughts??? I greatly appreciate your help.
Set objXMLHTTP = Server.CreateObject("MSXML
objXMLHTTP.Open "GET", "http://localhost/test/x.asp?par1=val1&par2=val2", False
objXMLHTTP.Send
Error Type:
msxml3.dll (0x80072EE2)
The operation timed out
/test/x.asp, line 17
Thanks.
One possible suggestion is do a loop until the readystate=4
Something like...
Set XMLHttp = CreateObject("Microsoft.XM LHTTP")
XMLHttp.async = false
Do Until XMLHttp .ReadyState = 4
' Wait until xmldoc is loaded before continuing.
Loop
...
...
Then on as normal.
hongjun
Something like...
Set XMLHttp = CreateObject("Microsoft.XM
XMLHttp.async = false
Do Until XMLHttp .ReadyState = 4
' Wait until xmldoc is loaded before continuing.
Loop
...
...
Then on as normal.
hongjun
hey there hongjun!
Server.CreateObject("MSXML 2.ServerXM LHTTP")!!!
Thank god for ASP.NET
Server.CreateObject("MSXML
Thank god for ASP.NET
hey!!!
b1xml2!!!
You are back?
hongjun
b1xml2!!!
You are back?
hongjun
yep, check my points for the month =)
Yap!!! Just checked :)
Welcome !!!
Go reclaim your top spot for XML!!!
hongjun
Welcome !!!
Go reclaim your top spot for XML!!!
hongjun
Where have you been to? Busy must be...
I am also a bit busy.. Am actually studying for final exams.. Studying Financial Accounting at the moment and kinda too bored over this subject and ..haha
hongjun
I am also a bit busy.. Am actually studying for final exams.. Studying Financial Accounting at the moment and kinda too bored over this subject and ..haha
hongjun
and climbing back in XML, ASP.NET <GRIN>...
try
Server.CreateObject("MSXML 2.ServerXM LHTTP.3.0" )
or
Server.CreateObject("MSXML 2.ServerXM LHTTP.4.0" )
and make sure this page runs without xmlhttp request > http://localhost/test/x.asp?par1=val1&par2=val2
Server.CreateObject("MSXML
or
Server.CreateObject("MSXML
and make sure this page runs without xmlhttp request > http://localhost/test/x.asp?par1=val1&par2=val2
you can;t call to yourself!!
/test/x.asp, line 17
/test/x.asp, line 17
we need better glasses... :)
and sometimes even fortune telling and mind reading abilities as well =)
haha
huhu
ASKER
actually I am not calling the same page...
test/x.asp is calling http://localhost/test/y.asp?par1=val1&par2=val2"
test/x.asp is calling http://localhost/test/y.asp?par1=val1&par2=val2"
oops..! did you try my suggestions then?
ASKER
yes. I did. But the actual page "y.asp" is taking more than 2min to render the data. I tried to set objXMLHTTP.waitForResponse to 9000 seconds. But this is not working...
Here is the function code
Function GetHTML(strURL)
response.write(strURL)
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateObject("MSXML 2.ServerXM LHTTP.4.0" )
objXMLHTTP.Open "GET", strURL, true
Call objXMLHTTP.Send
'Turn off error handling
On Error Resume Next
'Wait for up to 3 seconds if we've not gotten the data yet
If objXMLHTTP.readyState <> 4 then
response.write(objXMLHTTP. readyState )
objXMLHTTP.waitForResponse 9000
End If
'Did an error occur? If so, use a default value for our data
If Err.Number <> 0 then
response.write("Error")
strData = "some default text..."
End If
strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
GetHTML = strReturn
End Function
Here is the function code
Function GetHTML(strURL)
response.write(strURL)
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateObject("MSXML
objXMLHTTP.Open "GET", strURL, true
Call objXMLHTTP.Send
'Turn off error handling
On Error Resume Next
'Wait for up to 3 seconds if we've not gotten the data yet
If objXMLHTTP.readyState <> 4 then
response.write(objXMLHTTP.
objXMLHTTP.waitForResponse
End If
'Did an error occur? If so, use a default value for our data
If Err.Number <> 0 then
response.write("Error")
strData = "some default text..."
End If
strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
GetHTML = strReturn
End Function
one minute=60000
two minutes=120000
three minutes=180000
and so on...
two minutes=120000
three minutes=180000
and so on...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
waitForResponse is not waiting for specified amount of seconds. It's giving the error "The operation has been canceled"
that's because you need to change "true" to "false" like so
xmlServerHttp.open("GET", "http://localhost/sample.asp", False)
true is a boolean indicator of whether the call is asynchronous or not, for true you need to specify a callback function for onreadystatechange event
xmlServerHttp.open("GET", "http://localhost/sample.asp", False)
true is a boolean indicator of whether the call is asynchronous or not, for true you need to specify a callback function for onreadystatechange event
I forgot to mention that I think onreadystatechange is not supported for ASP, but I'm not 100% sure :o)
if you want to try onreadystatechange then do it like this
Dim _response
Private Function _ReadyStateChange()
_response=xmlServerHttp.re sponseText
End Function
Set xmlServerHttp=Server.Creat eObject("M SXML2.Serv erXMLHTTP. 4.0")
xmlServerHttp.OnReadyState Change = _ReadyStateChange
xmlServerHttp.open("GET", "http://localhost/sample.xml", True)
xmlServerHttp.send()
While xmlServerHttp.readyState <> 4
xmlServerHttp.waitForRespo nse(1000)
Wend
Dim _response
Private Function _ReadyStateChange()
_response=xmlServerHttp.re
End Function
Set xmlServerHttp=Server.Creat
xmlServerHttp.OnReadyState
xmlServerHttp.open("GET", "http://localhost/sample.xml", True)
xmlServerHttp.send()
While xmlServerHttp.readyState <> 4
xmlServerHttp.waitForRespo
Wend
or without
While xmlServerHttp.readyState <> 4
xmlServerHttp.waitForRespo nse(1000)
Wend
While xmlServerHttp.readyState <> 4
xmlServerHttp.waitForRespo
Wend
any luck..?
http://www.4guysfromrolla.com/webtech/102401-1.shtml
hongjun