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

XMLVisual Basic Classic

Avatar of undefined
Last Comment
dcsweb
ASKER CERTIFIED SOLUTION
Avatar of neeraj523
neeraj523
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
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.
Avatar of neeraj523
neeraj523
Flag of India image

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
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.
Visual Basic Classic
Visual Basic Classic

Visual Basic is Microsoft’s event-driven programming language and integrated development environment (IDE) for its Component Object Model (COM) programming model. It is relatively easy to learn and use because of its graphical development features and BASIC heritage. It has been replaced with VB.NET, and is very similar to VBA (Visual Basic for Applications), the programming language for the Microsoft Office product line.

165K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo