Solved

XMLHTTP in VBA>>>

Posted on 2004-08-30
4
1,657 Views
Last Modified: 2006-11-17
Hi..

I want to send the XML file as object to server(ASP) from Excel VBA..when I send xml file with size of 32K its working..I got response too..
but when I send the XML file as object with size of 2-5MB..I got the Error:

error : metod 'send' of  object 'IXMLHTTPREQUEST' failed


How TO I SEND the 2-5 MB xml file as object?

My Code in vba :
*******
'oxml.Load "c:\InputFinal.xml" ' 2.5 MB File
oxml.Load "c:\new.xml"        ' 89k file

'url = "XMLFILE=" & oxml.xml

With oXMLHttp
    .Open "POST", "http://localhost/projects/ASP Page2.asp", False
    .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    .send oxml
End With

' Write the response from my server.
 MsgBox oXMLHttp.Status
 MsgBox oXMLHttp.statusText
 MsgBox oXMLHttp.responseText
 'MsgBox oXMLHttp.responseStream

IN ASP CODE :
**********
Dim objxml       
set objxml = server.createObject("MSXML2.DOMDocument")
      
strTemp = Request("XMLFILE")
objxml.load (strTemp)      
objxml.save ("c:\test.xml")      

thanks and regards
Thanigaivelan P S
0
Comment
Question by:ps_velan
4 Comments
 
LVL 4

Accepted Solution

by:
divt earned 500 total points
ID: 11984040
I suspect the problem comes from the time it takes to transfer the large file.
Microsoft has published this good article:

Time-Outs in XMLHTTP, and Controls with a View
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaskdr/html/askgui05012001.asp

They suggest using ServerXMLHTTP instead of XMLHTTP.  See this FAQ for complete details:

Frequently asked questions about ServerXMLHTTP
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q290/7/61.asp&NoWebContent=1

Alternatively, you may want to look WinHTTP which accept time-out settings, and should also fit in your code:
http://msdn.microsoft.com/library/en-us/winhttp/http/about_winhttp.asp

See sample usage for WinHTTP here:
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21119195.html
Good luck.


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will show you how to use shortcut menus in the Access run-time environment.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now