Skip to main content
Visual C++ Samples 
WeatherService Sample: An XML Web Service Created with ATL Server 

Download sample

Demonstrates implementing a simple XML Web service using ATL Server attributes and accessing an XML Web service from an MFC-based client application. This sample also shows layered window support available in Windows 2000 and later.

The WeatherService sample allows access to weather conditions in a variety of cities. The client application demonstrates layered window support, so it requires Windows 2000 or later to run. For best results, set your color depth to 16-bit or better.

Security noteSecurity Note

This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.


  • IIS (client and server)

  • Windows 2000 or later (MFC client only)

Building and Running the Sample

To build and run this sample

  1. Open the web service solution WeatherService.sln in the Visual Studio development environment.

  2. Build the solution. This will deploy the solution to the local Web server.

  3. Open the client solution WeatherServiceClient\wcli.sln.

  4. Add a web reference from the client to the web service:

    • Right-click on the WeatherServiceClient project in the Solution Explorer and select Add Web Reference....

    • Click the Web services on the local machine link. A list of web services on your machine should appear.

    • Click on the WeatherService link.

    • Change the web reference name from localhost to WeatherService and click Add Reference.

  5. Build the client solution.

  6. Run the client executable file and use the UI to access the weather service.


See Also