Solved

XMLHTTP in VBA>>>

Posted on 2004-08-30
4
1,651 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now