Make XML Requests Over HTTP (Visual Basic)

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - DOM Developer's Guide

Make XML Requests Over HTTP (Visual Basic)

This tutorial demonstrates how to request an XML data file from a web server using HTTP. The Visual Basic application is a client making the request, and localhost is a local Web server. An XML data file containing contact information (contacts.xml) is stored on the server. The server fulfils the request through an ASP page (contact.asp), which is accessible from the localhost/sxh virtual directory. The request is made in an asynchronous call. We create a class module (as the handler to the onreadystatechange event) to process the response when it becomes available.

This project uses or creates the following files and directories.

Component Description
Source: XMLOverHTTP.cpp This Visual Basic source file retrieves and displays XML data from a Web server.
Class Module: myHttpRequestHandlers This class module enables asynchronous requests.
Virtual Directory: sxh A virtual directory, with a corresponding directory on your drive.
Resource: contacts.xml An XML data file containing contact information
ASP Page: contact.asp An ASP page that queries a DOM object loaded from the contacts.xml file.
Output You should this output get when you run the XMLOverHTTP project.

To create the XMLOverHTTP Visual Basic Project

  1. Create a Visual Basic project and set a reference to MSXML 5.0. For detailed instructions on how to do this, see Set Up My Visual Basic Project.
  2. Name the project XMLOverHTTPProj.

Next, we’ll add the source code for this project.