Aaron Johnson Now with 50% less caffeine!

Posted
17 June 2003 @ 10pm

Tagged
ASP

MSXML2.XMLHTTP.4.0

Worked around a nasty issue on an ASP site today, I’m was using the MSXML2.XMLHTTP.4.0 object to post an XML packet to a SOAP server. Worked great on our development and staging servers, but I installed it (the app) on the client server today and get this… calling the send() method completely hangs IIS, you can’t stop the service, you can’t restart the service. Here’s the code snippet in question:

Dim objHTTP
Set objHTTP = Server.CreateObject(”Msxml2.XMLHTTP.4.0″)
objHTTP.open “POST”, “http://yourhost/endpoint.do”, false
objHTTP.setRequestHeader “Content-Type”, “text/xml”
objHTTP.setRequestHeader “SOAPAction”, “urn:myserver/soap:ThisName/thisMethod”
objHTTP.send xmlpacket
strReturn = objHTTP.responseXML.xml

The behavior I’m seeing is that the HTTP request doesn’t even get sent to the remote server, the IIS process becomes unusable, and restarting the W3/IISAdmin services don’t work. I’m using MSXML 4.0 Service Pack 2 (available here).


21 Comments

Posted by
Michael
29 August 2003 @ 2pm

Hi did you find any solution to this problem?.
We are facing exactly the same problem.

We are using Coldfusion. and MsXml send method just hangs.

your feedback is deeply appreciated.

thank you,
-Michael


Posted by
Aaron Johnson
29 August 2003 @ 3pm

hey Michael,

The only solution I found to the problem was to use the Microsoft.XMLHTTP object instead of the MSXML2.XMLHTTP.4.0 object. I was working in an ASP environment at that time, so that solution worked for me… hopefully it’ll work for you in CFMX as well.

AJ


Posted by
Gunner Olesen
4 October 2003 @ 10am

I had “hang on second send” problem untill
i remembered to close the socket on the server
side, after having send the soap response.


Posted by
Akhilesh
6 January 2004 @ 11am

I am using this:

Public Function SendRecieveHTTP(pstrURL, pstrMsgType, pstrXMLReqMsg)
Dim lobjXMLHTTPObj, lstrACKMessage
Dim lstrURL

lstrURL = Cstr(ReadIni(gstrINIFile, “HTTPPATH”, “Path” & gintICtr)) ‘This can be commented since it already is being sent with URL
lstrURL = lstrURL & “?FrancID=” & gstrFranchiseID & “&MsgTyp=” & pstrMsgType

Set lobjXMLHTTPObj = CreateObject(”MSXML2.XMLHTTP”)
CheckError(”Instantiating XML Object”)

lobjXMLHTTPObj.Open “POST”, lstrURL, False
CheckError(”HTTP Connection installation”)

lobjXMLHTTPObj.Send pstrXMLReqMsg
Msgbox pstrXMLReqMsg
CheckError(”SENT CONNECTION INSTALL MESSAGE”)
‘LogEvent(”Send Message Attempt No : ” & gintJCtr & ” of ” & gintURLRetryCnt)
LogEvent(RetHttpMessage(lobjXMLHTTPObj.status))

SendRecieveHTTP = lobjXMLHTTPObj.responseText
CheckError(”RECIEVE ACK MESSAGE”)

Set lobjXMLHTTPObj = Nothing
End Function

and it works Fine!!

See if you guys can churn something out of it!!

To my understanding Except the IIS/Web server there shouldn’t be any other problem

To check that my Web server is healthy I use this ASP code:

Hope this helps


Posted by
Akhilesh
6 January 2004 @ 11am

Sorry My Test Web server Code was eaten up, trying again:

Dim xo, var

Set xo = Server.CreateObject(”MSXML2.XMLHTTP”)
‘xo.open “POST”, “http://P1055604:password@02537D0004648/IFB/RecieveMsg.asp?FrancID=9328&MsgTyp=CONNINSTALLREQ”, False
xo.open “GET”, “http://P1055604:password@localhost:81/IFB/RecieveMsg.asp”, False

xo.send “TESTDATATESTDATATESTDATATESTDATATESTDATATESTDATA”
var = xo.responseText
Response.Write “From Here—-” & var & ” —TILL HERE”

Good Luck!!


Posted by
dfg
6 March 2004 @ 6am

sdf


Posted by
ramesh
29 December 2004 @ 3pm

could not create object in my program


Posted by
mohsen
14 January 2005 @ 2pm

<%
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject(”Microsoft.XMLHTTP”)

‘ Notice the two changes in the next two lines:
xml.Open “POST”, “http://www.semnan.medu.ir/search.asp”, False
xml.Send “q=irphc&s=all”
Response.Write xml.responseText
Set xml = Nothing
%


Posted by
Peter Ryan
9 April 2005 @ 8pm

Have you tried using the “MSXML2.ServerXMLHTTP.4.0″ object?

(from memory) the regular XMLHTTP object isn’t quite as robust since it was designed more for client side rather than server side use.


Posted by
George Helyar
29 June 2005 @ 2pm

i used to get this problem with Microsoft.XMLHTTP, it worked about 10 times a day and then every app on the server that used it after that just hung.

switching to Msxml2.ServerXMLHTTP totally fixed this, i looked into it and its actually the same as Msxml2.ServerXMLHTTP.3.0 on my server as i dont have 4.0 installed, i believe Msxml2.ServerXMLHTTP just runs the highest one you have


Posted by
Ian
25 July 2005 @ 1pm

I have gotten all the above problems..the last one i ended up with is nothing being displayed.
This is the code:

Dim xml
Set xml = Server.CreateObject(”Microsoft.XMLHTTP”)

On Error Resume Next

xml.Open “GET”, “http://www.rss.cnn.com/rss/cnn_world.rss”, false

xml.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”

If err.Number <> 0 Then
Response.write Err.Description
End If

xml.send

Response.write “Here’s the html we now have in our xml object”
Response.write “”
Response.Write “”
Response.Write xml.responseText
Response.Write “”
Response.write “”
Response.write ” Now here’s how the page looks:”
Response.Write xml.responseText

Set xml = Nothing
%>

Strangly it works with firefox for local and external url’s but IE only works for local url’s..Is this possibly a security issue in IE.Has anyone experienced these problems before? Assistance is appreciated.


Posted by
Dman
27 July 2005 @ 1am

Ian, I think the issue with your script may be the 5th line, xml.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded” . I was having a similiar problem using the post method with the text/xml and switched it to application/x-www-form-urlencoded and that fixed it. Try using text/xml instead.


Posted by
SMS Gateway
25 October 2005 @ 12am

I’ve been pulling my hair on this:

The data doesn’t seem to be posting and can’t figure out why?


Posted by
Dragonlaird
19 November 2005 @ 9am

OK - It took a while but I finally sussed why ServerXMLHTTP.4.0 didn’t seem to like POSTing data…

It seems the optional Send() parameter accepts 2 formats, either XML or the traditional GET string.

I used the latter (it’s simpler to code) and below is how I formatted the string ready to ‘POST’ to my remote URL…

sResult = “”
For Each sTemp In Request.Form
sResult = sResult & “&” & sTemp & “=” & Server.UrlEncode(Request.Form(sTemp))
Next
If Len(sResult) > 0 Then
sResult = “?” & Mid(sResult, 2)
End If
‘ Note that the String is EXPECTED to start with a question mark!!!
Now you can submite using…
oXMLHTTP4.Send(sResult)

Ta daa….


Posted by
Krishna
16 October 2006 @ 5pm

This might be the reason for IIS becoming unstable …
——-
If pooling is set to Low or Medium (this is the default for Microsoft Windows 2000), you should POST to an ASP in a different virtual folder. If the ASP is in the same virtual folder, the ASP stops responding (hangs). After you close the browser, that ASP and other ASPs continue to hang because the request stays queued even though you close the browser. You must restart IIS or restart the computer.
——-
Check this:
http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q290591&ID=KB;EN-US;Q290591


Posted by
Elgemcdlf
14 April 2007 @ 7am

Same problem here. My code is same as most all posted here:

Set btl_http = CreateObject(”Msxml2.ServerXMLHTTP.6.0″)
btl_http.settimeouts 5000, 5000, 15000, 15000
btl_http.Open “GET”, btl_url, False
btl_http.Send

If btl_http.readyState 4 Then
btl_http.waitForResponse 60
End If

If btl_http.readyState 4 Or btl_http.Status 200 Then
Goto failed_btl
End If

I have tried both methods POST and GET. SetTimouts has no effect. I have tried the XMLHTTP and here serverxmlhttp. I have stepped through each line and determined it does not progress beyond send.

When attempting to access the site with a browser it just hangs there and then gives the not able to connect page. Browser in use is IE7. What I believe we all need is whatever scrap of code makes IE kick out when in this situation.

If anyone has any answers to this jewel I would be eternally grateful.


Posted by
Derek Curtis
9 May 2007 @ 9am

I had the same problem on a site I was working on for a customer. I resolved it by removing the version specific information from Msxml2.XMLHTTP. Once I did that, everything worked like a charm.


Posted by
Sujata
5 July 2007 @ 6am

How do we automate downloading of internet files in Excel VBA with the use of MSXML2. XMLHTTPO thing?
I need to deliver something to the customer and its urgent.


Posted by
Nishanth
9 July 2007 @ 3am

Here is the code segment in which i face difficulty in creating object. Object is not created. I am using MS Vista Business as OS.
Set objXMLHTTP = CreateObject(”MSXML2.XMLHTTP.4.0″)
objXMLHTTP.Open “GET”, strURL, false
objXMLHTTP.Send

But this code works on other machine with vista. Please help me.


Posted by
Smriti
8 August 2007 @ 12am

The code works fine for me.
But i want to pass a variable to the web-method in the web service while calling it.
How do we pass values to the function of a web service while calling it in asp?


Posted by
Amy
19 June 2008 @ 9am

I used this http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q290591&ID=KB;EN-US;Q290591 to made it working on Windows XP(my local), but on another server, we use Windows 2003, that still caused “continue to hang even though I close the browser. I must restart IIS” Please help.


Leave a Comment

The Poetry of Programming Eclipse in Action