This documentation is archived and is not being maintained.

Acronym-WebService Sample (Create and Consume an XML Web Service) 

Visual Studio 2005

Download sample

This sample demonstrates how to:

  • Create an XML Web service.

  • Use Web controls such as buttons, labels, and DataGrids.

  • Consume a Web service.

The Web service takes the first few characters of the acronym and returns all matching acronyms.

The Web application consumes this Web service and binds the contents of the dataset to the server-side Datagrid control.

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

  • Microsoft Visual Studio

  • Microsoft Visual J#

Building and Running the Sample

To open the sample file in Solution Explorer

  1. Click Download Sample.

    The File Download message box appears.

  2. Click Open, and on the left column of the zip folder window, click Extract all files.

    The Extraction Wizard opens.

  3. Click Next. You can change the directory that the files will be extracted to, and then click Next again.

    Make sure that the Show extracted files check box is selected, and click Finish.

  4. Double-click the sample's .sln file.

    The sample solution is displayed in Solution Explorer. You might get a security warning that says the solution location is not trusted. Click OK to continue.

To prepare to run this sample

  1. After you download the sample directories (AcronymWA and AcronymWebServiceInJavaLanguage) to your machine, copy them under %SystemDrive%\inetpub\wwwroot.

  2. Make AcronymWA a virtual directory under IIS following the steps given below:

    1. From Start, choose Programs, then Admin Tools, and then Internet Services Manager.

    2. Right-click the default Web site from the tree and choose New, then Virtual Directory.

    3. Set the alias to AcronymWA.

    4. Set the location to %SystemDrive%\inetpub\wwwroot\AcronymWA.

    5. Select all the access permissions options (Read, RunScripts, Execute, Write, and Browse).

  3. Create a virtual directory for AcronymWebServiceInJavaLanguage following the same steps as above.

  4. Add Write permission to the subdirectory AcronymWebServiceInJavaLanguage for the local user account ASPNET (<your_machine_name>\ASPNET). This enables the Web service to read and write to the Microsoft Access database Acro.mdb, which is located in this directory.


    In the WhatItMeans.asmx.jsl file, locate the set_ConnectionString method and replace C: with the appropriate drive letter if necessary.

  5. Open Microsoft Visual Studio .NET.

  6. Open AcronymWA.sln from %SystemDrive%\inetpub\wwwroot\AcronymWA.

  7. From the Build menu, click Build Solution.

  8. In Solution Explorer, right-click AcronymExplainer.aspx and select Set as Startup Page.

To test the sample

  1. Select Start Without Debugging from Debug menu. You will see the page that prompts for the acronym. The Acro.mdb database can be accessed through Microsoft Access with the database password vj#sample.

  2. Type any character in the edit box.

  3. Click the Get Acronym button.

  4. List of titles appear in the Datagrid.

See Also