Share via


Make XML Requests Over HTTP (Smart)

 

This tutorial demonstrates how to request an XML data file from a web server using HTTP. The C++ application presented here is a client making the request. A local Web server (localhost) is used for the demonstration. The XML data consists of a set of contact information (contacts.xml) that is stored as an XML file on the server. The server fulfils the request through an ASP page (contact.asp), which is accessible from the localhost/sxh virtual directory.

This project uses the following files and directories.

Component Description
Source: XMLOverHTTP.cpp Retrieves and displays XML data from a Web server.
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 This is the output you should get when you build and run the XMLOverHTTP project.

Create the XMLOverHTTP Visual C++ Project

  1. Create a Win32 console application in Visual C++. For detailed instructions on how to do this, see Set Up My Visual C++ Project. Name the project XMLOverHTTPProj.

Next, we'll add the source code for the XMLOverHTTPProj project.