Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP XML
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP XML Using ASP 3 and XML. See also the XML category for more XML discussions not relating to ASP. NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP XML section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 27th, 2003, 03:23 PM
Registered User
 
Join Date: Oct 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
Default post xml using xmlhttp in vb.net

I've run into numerous articles stating that the following code will work in VB.NET. Well it does NOT work for me.

'-- DOES NOT WORK IN VB.NET
Dim xmlDocReq As New MSXML2.DOMDocument40()
xmlDocReq.async = False
xmlDocReq.resolveExternals = False
xmlDocReq.setProperty("ServerHTTPRequest", True)
xmlDocReq.load(Request) **** error: parameter is incorrect *****

The code below is tested and does work in VB.NET. The objective is to load and pass an XML document object from a sending page to a receiving page, and back (basically an echo). Let me know if you have any questions.

--------------------------------------------------
SENDER (Called in Sub Page_Load...)
--------------------------------------------------
        'Set Receiving page
        Dim strURL As String = "http://localhost/DevCitrus/ImportXML/ImportXMLRecieve.aspx"

        'Set path of xml file to pass via HTTP
        Dim xmlPath As String = "C:\TestXML\Manifest.xml"

        'Send XML document to receving page and print result
        Try
            Dim xmlDoc As New MSXML2.DOMDocument40()
            Dim xmlHTTP As New MSXML2.ServerXMLHTTP40()

            'Load xml doc
            If xmlDoc.load(xmlPath) Then
                'Set method, url, async
                xmlHTTP.open("POST", strURL, False)
                'Send XML document
                xmlHTTP.send(xmlDoc.xml)
                'Set content type
                Response.ContentType = "text/xml"
                'Output xml result
                Response.Write(xmlHTTP.responseText)
            Else
                Response.Write(xmlDoc.parseError.reason)
            End If
        Catch ex As Exception
            Response.Write("<MANIFEST><catchError>" + ex.Message + "</catchError></MANIFEST>")
        End Try

--------------------------------------------------
RECEIVER (Called in Sub Page_Load...)
--------------------------------------------------

        'Set Content tpe
        Response.ContentType = "text/xml"

        'Create xmlDoc
        Dim xmlDocReq As New MSXML2.DOMDocument40()

        xmlDocReq.async = False
        xmlDocReq.resolveExternals = False
        xmlDocReq.setProperty("ServerHTTPRequest", True)
        Try
            If xmlDocReq.load(Request.BinaryRead(Request.TotalByt es)) Then
                'Return echo of loaded XML doc
                Response.Write(xmlDocReq.xml)
            Else
                Response.Write("<MANIFEST><parserError>" + xmlDocReq.parseError.reason + "</parserError></MANIFEST>")
            End If
        Catch ex As Exception
            Response.Write("<MANIFEST><catchError>" + ex.Message + "</catchError></MANIFEST>")
        End Try


==================================
Bill Screen
Programmer / Analyst

Sun Certified Programmer for the Java 2 Platform
Sun Certified Web Component Developer for J2EE

Sun Certified Enterprise Architect (Part I)

INFINITY SOFTWARE DEVELOPMENT, INC.
3522 Thomasville Rd ~ Suite 200
Tallahassee, FL. 32308-3488
Phone: 850.383.1011
Fax: 850.383.1015
http://www.infinity-software.com

==================================


Reply With Quote
  #2 (permalink)  
Old September 24th, 2004, 04:54 PM
Registered User
 
Join Date: Sep 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

I would like to implement the code you have posted. How do i reference the MSXML2.DOMDocument40()?

Imports ?

What namespace is MSXML2 under?

Thanks!

Gregg

Reply With Quote
  #3 (permalink)  
Old August 3rd, 2009, 01:02 PM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default MSXML repacement in VB.NET

Hi all,
I too want to know the namespace to import MSXML2. Pls suggest ur thoughts...
I found that MSXML2 is a COM+ object (Interop.MSXML2.dll). Can we add this in VB.NET and SSIS 2005 proejcts ?

Thanks
Suresh
Reply With Quote
  #4 (permalink)  
Old August 3rd, 2009, 01:09 PM
Friend of Wrox
Points: 6,525, Level: 34
Points: 6,525, Level: 34 Points: 6,525, Level: 34 Points: 6,525, Level: 34
Activity: 33%
Activity: 33% Activity: 33% Activity: 33%
 
Join Date: Nov 2007
Location: Germany
Posts: 1,221
Thanks: 0
Thanked 238 Times in 237 Posts
Default

This forum is about classic ASP where you could use MSXML with VBScript or JScript.
Using MSXML with .NET is not recommended http://support.microsoft.com/kb/815112 and not necessary as System.Xml in the .NET framework has managed implementations of DOM, XPath, XSLT.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Reply With Quote
  #5 (permalink)  
Old August 7th, 2009, 06:31 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Hi Martin,

Thank you for your reply and the link.
I have found out what I wanted...
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I post a XML file to an URL using VB? chengjianjin Visual Basic 2005 Basics 3 April 28th, 2008 06:24 AM
Request Post XMLHttp : Need Help Kyum BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 5 July 5th, 2007 10:51 PM
XML Post From VB to asp page LanceAtCti VB How-To 2 July 13th, 2006 09:58 AM
post xml using xmlhttp in vb.net datakix VB.NET 3 December 21st, 2004 01:31 PM
XML Post using microsoft.XMLHTTP csmajor231 XML 0 April 5th, 2004 04:06 PM



All times are GMT -4. The time now is 12:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.