XMLHTTPRequest: Run-Time Error on .Send Command
I receive two different errors messages when attempting to submit the XML object. The first message is produced on the following line of code:
http.send reqDoc
My system hangs for about 2 minutes on this line and then produces the following message:
Run-time error '-2146697208 (800c0008)':
The download of the specified resource has failed.
After I receive this message the application fails and I have to restart the application. After restarting the application the "http.send reqDoc" line executes but the http object indicates that the response XML object has not been received. It is at this point that I receive the second message which is:
Input Segments are Invalid
I believe that the "Input Segments are Invalid" message is on account of the XML string not being formatted properly, however, I am unsure why I only receive this message after I stop and restart the application.
Can anyone explain what is causing the first error message?
The VB code is as follows:
Private Sub BtnSubmit_Click()
' Build XML Object
' Create an empty DOM document
Dim reqDoc As MSXML2.DOMDocument40
Set reqDoc = CreateObject("Msxml2.DOMDocument.4.0")
' Post XML Object To Equifax
' Submit the request to the server
Dim a As Boolean
Dim http As MSXML2.XMLHTTP40
Set http = CreateObject("Msxml2.XMLHTTP.4.0")
http.open "POST", "https://www.website.com/processingpage.asp", False
reqDoc.Load ("C:\customerdata1.xml")
http.send reqDoc
' Check for HTTP errors
If http.Status <> 200 Then
' Complain about the error
TxtResults.Text = "HTTP Error " & http.Status & " (" & http.statusText & " occurred)"
Exit Sub
End If
' Get the response document from the server
Dim respDoc As MSXML2.DOMDocument40
Set respDoc = CreateObject("Msxml2.DOMDocument.4.0")
respDoc.setProperty "SelectionLanguage", "XPath"
respDoc.Load (http.responseStream)
' Check for XML parse errors
If respDoc.parseError.errorCode <> 0 Then
' Complain about the error
tmpString = "Invalid response: " & respDoc.parseError.reason & " at line " & respDoc.parseError.Line
Exit Sub
End If
End Sub

