Solved

XMLHTTP in VBA>>>

Posted on 2004-08-30
4
1,682 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Outlook Free & Paid Tools
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
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…

632 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