Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 27th, 2003, 03:23 PM
Registered User
 
Join Date: Oct 2003
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

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


 
Old September 24th, 2004, 03:54 PM
Registered User
 
Join Date: Sep 2004
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

 
Old August 3rd, 2009, 12: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
 
Old August 3rd, 2009, 12:09 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 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
 
Old August 7th, 2009, 05: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...





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 05:24 AM
Request Post XMLHttp : Need Help Kyum BOOK: Professional Ajax 2nd Edition ISBN: 978-0-470-10949-6 5 July 5th, 2007 09:51 PM
XML Post From VB to asp page LanceAtCti VB How-To 2 July 13th, 2006 08: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 03:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.