Link to home
Start Free TrialLog in
Avatar of dcsweb
dcsweb

asked on

Getting error 2146697208 when sending an XML document

I am sending multiple XML requests to another server and at some point (which differs every time I run it), I will get "Error: -2146697208 The download of the specified resource has failed."  I have XML requests stored in a database and am using VB 6.0 to send them to another server, looping through each one. Sometimes I can only send 2 requests before I get this error, sometimes 10, sometimes more. I have determined that it dies on the "myxml.Send mydoc" statement and I am at a complete loss as to what causes this error and how to fix it.
Set myxml = CreateObject("Microsoft.XMLHTTP")
    Set myxsl = CreateObject("MSXML2.DOMDocument")
    myxsl.Load ("myfile.xsl")
    Set mydoc = CreateObject("MSXML2.DOMDocument")
    
    CommandText = "Select <<fields>> From <<table>>"
    Set qry = DBConn.Execute(CommandText, , adCmdText)
    
    If qry.BOF And qry.EOF Then
    Else
        qry.MoveFirst
        Do While Not qry.EOF
            '******************************
            'myXMLquery is defined here
            '******************************
            mydoc.loadXML myXMLquery
            Dummy = LogIt("mydoc.loadXML loaded")
            
            If mydoc.parseError.ErrorCode Then
                Dummy = LogIt("mydoc.parseError.ErrorCode = " & mydoc.parseError.ErrorCode)
            Else
                myxml.Open "GET", "http://<<otherserver>>", False
                Dummy = LogIt("myXML.Open successful")
                myxml.setRequestHeader "Content-type", "text/xml"
                myxml.Send mydoc
                Dummy = LogIt("XML document sent")
                
                Set myresponse = myxml.responseXML
                Dummy = LogIt("XML response received")
               
                '******************************
                'now process the response
                '******************************
                myresponse.transformNodeToObject myxsl, mydoc
                'results stored in a database here
            End If
            qry.MoveNext
        Loop
    End If
    
    qry.Close
    Set qry = Nothing
    
    Set mydoc = Nothing
    Set myxml = Nothing
    Set myxsl = Nothing
    Set myresponse = Nothing

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of neeraj523
neeraj523
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dcsweb
dcsweb

ASKER

Thanks, I will try adding the server to my hosts file and put in some exception handling for this and see if that helps.
Any other ideas are still welcome. Otherwise, I will accept the above as the solution.
well.. what was coming out of my mind after reading your problem, i posted here.. but if i get more info on this issue or any further symptoms of this problem, i may able to provide more insides..

better you first try what i said and see if any imporvements..

one more thing you can try if you can open the remote server using a web browser when u r getting this error in your program.
Avatar of dcsweb

ASKER

Well, I changed my code last night to try to reconnect if I get this error and that seems to work great. Thanks for your help. I had searched all over and couldn't find any specific explanation for that error.