This documentation is archived and is not being maintained.

How to Create and Deploy XML Web Services Using Visual Studio .NET and Office XP

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Frank C. Rice
Microsoft Corporation

May 2002

Applies to:
     Microsoft® Visual Studio® .NET
     Microsoft Access 2002
     Microsoft Office XP Web Services Toolkit

Summary: Learn how to create and deploy a sample XML Web service created with Microsoft Visual Studio .NET. A Microsoft Access 2002 form is used to access the XML Web service. (20 printed pages)

Download SoapToolkit20.EXE.


XML Web Services Overview
XML Web Services in Visual Studio .NET
Creating the XML Web Service
Creating the Client Application
Testing the XML Web Service


XML Web services provide a way for applications to exchange data and processing capability. Typically, an XML Web service is a dynamic-link library (DLL) that resides on a Web server and whose methods can be called over the Internet. In this scenario, a client application communicates with an XML Web service by sending and receiving SOAP messages over Hypertext Transfer Protocol (HTTP).

In this article, we will demonstrate how to create, deploy, and access an XML Web service using Microsoft® Visual Studio® .NET. First, we'll set up Internet Information Server (IIS) on the Web server hosting the XML Web service.

Note   IIS 4.0 is compatible with Microsoft Windows NT® 4.0 Server. IIS 5.0 is compatible with and installed by default with Windows® 2000 Server.

Then, using Visual Studio .NET, we'll create an ASP.NET Web Service project. Next, we'll add code to the project to implement the XML Web service. Our sample XML Web service will accept the two-digit name of a U.S. state and return information about the state to include the state's full name, its capital, the date the state was admitted to the union, and its order of admittance. We'll then test the XML Web service in Visual Studio .NET. And finally, we'll create a client application using a Microsoft Access 2002 form to access the XML Web service and display the results.

XML Web Services Overview

So what's involved in creating and using an XML Web service? Typically, a person might begin by navigating to a Web site hosting an XML Web service registry, such as the Universal Description, Discovery, and Integration (UDDI) registry service, to see what XML Web services are available. The registry service would provide information about the different XML Web services available, such as the name of the company hosting the XML Web service, the universal resource locator (URL) to the company's Web site, and the location of the WSDL file which the user uses to determine the details of the XML Web service.

A developer would then use the information gleaned from the WSDL file to develop a client application to access the XML Web service and process the results. The developer would first set a reference to the Microsoft SOAP Library (mssoap1.dll) which can be obtained by installing the SOAP Toolkit 2.0.

Note   The Microsoft SOAP Toolkit 2.0 SP2 can be downloaded from MSDN.

The Microsoft SOAP Library contains client-side (and server-side) components that allow an application to invoke XML Web service methods. The developer would then set a Web reference (using the Web Service References Tool) to the WSDL file.

Note   The Web Service References Tool is available in the Office XP Web Services Toolkit which can be downloaded from MSDN.

The Web Service References Tool creates a proxy class (a local representation of the XML Web service in the client application), which makes it easy to communicate with the XML Web service by using HTTP. This communication would consist of SOAP requests from the client application and SOAP responses from the XML Web service. The server implementing the XML Web service would use a "listener" (code that resides in the WSDL file or an Active Server Pages (ASP) file that implements a handler) to receive and parse the SOAP request. Once the listener detected a SOAP request from the client application, it would parse the request, invoke the XML Web service method passing in any parameters, and then receive the results of the method calls. The listener would then wrap the response in another SOAP message and send the response to the client application where the results are parsed and processed by the client-side component.

So far, we have looked at the client-side of consuming XML Web services. In order to create and implement an XML Web service on a Web server, you need the following:

  • A DLL that contains the functions (methods) that you want to make available as the XML Web service.
  • A way to tell clients interested in using the XML Web service what functionality is provided, the names of the methods, the input/output parameters used, and other information relevant to the XML Web service. A WSDL file provides this information.

In order to use an XML Web service, all you need to do is create the client application that accesses the XML Web service using the information contained in the WSDL file and ensure that the Microsoft SOAP Library is installed on each client computer. The development environment you use to create the client will determine what, if any, additional tools you might need.

XML Web Services in Visual Studio .NET

Microsoft Visual Studio .NET simplifies the task of creating and deploying XML Web services by automating the creation of many of the files needed to implement the XML Web service. For example, Visual Studio .NET provides an ASP.NET Web Service project type to help you create and work with XML Web services.

When you create an ASP.NET Web Service project, Visual Studio .NET automatically constructs a project and the files on the Web server (assuming you are developing the XML Web service on the Web server) needed to implement the XML Web service. For example, Visual Studio .NET automatically creates an .asmx file to contain the classes and methods that add functionality to the XML Web service.

Note   XML Web service classes are similar to standard classes with the exception that a [WebMethod] attribute is prefixed to a Web class.

Additionally, Visual Studio .NET creates the WSDL and WSML files for you and even provides an information page which displays the methods and parameters used in your XML Web service. You can also use this page to test your XML Web service.

On the client, you can use either Microsoft Visual Basic® 6.0, Visual Studio .NET, or an Office application such as Access or Microsoft Excel to create the client application to consume the XML Web service. First, you set a reference to the WSDL file. In an XML Web service implemented in Visual Studio .NET, this is done by referencing the .asmx file with a query string such as http://localhost/StatesInformationWS/StatesInformation.asmx?wsdl. In Visual Basic or an Office application, you would set the Web reference to the WSDL file by using the Web Service References Tool. The Web Service References Tool is available in the Office XP Web Services Toolkit which can be downloaded from MSDN.

The Web Service References Tool then takes the information in the WSDL file and creates a Microsoft Visual Basic for Applications (VBA) proxy class. The proxy class provides a local representation of the XML Web service in the client application. Additionally, because the XML Web service class is linked to the proxy in the client application, Microsoft IntelliSense® is available when you create the objects in the client. Then you add the code to your application that calls the methods in the proxy class and you are ready to start using the XML Web service.

Now let's put this information to work and create the XML Web service.

Creating the XML Web Service

In order to deploy the XML Web service, you'll need a Web server such as Microsoft Windows® 2000 Server running IIS. Then you'll need to set up a virtual root (also called a virtual directory) on the Web server where you can store the XML Web service files that you create.

Setting Up Internet Information Server

  1. Add a folder to the Web server. You can use an existing folder or create a new folder on the server. For this sample, I'd suggest creating a new folder (for example, C:\StatesInfoWS).
  2. Next, set up a virtual root in IIS. In the Control Panel, double-click Administrative Tools, and then double-click Internet Services Manager, which displays the Internet Information Services console.
  3. In the left-hand pane, expand the node containing the name of your Web server, right-click the Default Web Site node, point to New, and then click Virtual Directory. This opens the Virtual Directory Wizard.
  4. In the Welcome to the Virtual Directory Creation Wizard screen, click Next.
  5. In the Virtual Directory Alias screen, type StatesInfoWS, and then click Next.
  6. In the Web Site Content Directory screen, type the path to the folder you created in step 1 and click Next.
  7. In the Access Permissions screen, select the Read and Run scripts check boxes and click Next. Click Finish.

Creating the ASP.NET Project

Now we'll create a new Visual Basic .NET ASP.NET Web service project named StatesInformationWS and a class module named StatesInformation with the GetStateInfo method.

  1. Start Visual Studio .NET. On the Start page, click New Project.
  2. In the New Project dialog box, with the Visual Basic Projects selected in the Project Types list, click ASP.NET Web Service.
  3. In the Location box, type http://localhost/StatesInfoWS. Notice that by default, all XML Web service projects are stored in the localhost virtual directory of the Web server.
  4. Click OK. The project will contain a module called Service1.asmx, a configuration file, and a discovery file (.vsdisco). The configuration file contains configuration information for the Web server and the discovery file contains information that allows other applications that connect to your server to locate your XML Web service and see the names and syntax of its members.
  5. First, delete the Service1.asmx module as you will create your own file in the next step. Select the file, right-click, and click Delete. Click OK in the confirmation dialog box.
  6. You will now add your own .asmx file. In the Solution Explorer, right-click StatesInformationWS, select Add, and then Add New Item.
  7. In the Add New Item dialog box under Web Project Item, select the Web Service icon, and type StatesInformation.asmx. Click OK.
  8. Right-click StatesInformation.asmx and select View Code.
  9. Add the following code under the Web Services Designer Generated Code statement. This will be the method used to add functionality to your XML Web service:
    <WebMethod()> Public Function GetStateInfo(ByVal strAbbreviatedName 
             As String) As String
        'Purpose: This procedure is used to simulate an
        '         XML Web service. The procedure accepts
        '         the two-digit name for a state and
        '         returns information about that state.
        'Accepts: strAbbreviatedName - the two-digit state
        '                             name.
        'Returns: Information about the state including
        '         its full name, capital, date admitted
        '         to the union, and order of admission.
        Select Case UCase(Trim(strAbbreviatedName))
            Case "AL"
                Return "Name: Alabama " & _
                    "Capital: Montgomery " & _
                    "Admitted: December 14, 1819 " & _
                    "Order: 22"
            Case "AK"
                Return "Name: Alaska " & _
                    "Capital: Juneau " & _
                    "Admitted: January 3, 1959 " & _
                    "Order: 49"
            Case "AZ"
                Return "Name: Arizona " & _
                    "Capital: Phoenix " & _
                    "Admitted: February 14, 1912 " & _
                    "Order: 48"
            Case "AR"
                Return "Name: Arkansas " & _
                    "Capital: Little_Rock " & _
                    "Admitted: June 15, 1836 " & _
                    "Order: 25"
            Case "CA"
                Return "Name: California " & _
                    "Capital: Sacramento " & _
                    "Admitted: September 9, 1850 " & _
                    "Order: 31"
            Case "CO"
                Return "Name: Colorado " & _
                    "Capital: Denver " & _
                    "Admitted: August 1, 1876 " & _
                    "Order: 38"
            Case "CT"
                Return "Name: Connecticut " & _
                    "Capital: Hartford " & _
                    "Admitted: January 9, 1788 " & _
                    "Order: 5"
            Case "DC"
                Return "Name: District_of_Columbia " & _
                    "Capital: Not_Applicable " & _
                    "Admitted: N/A " & _
                    "Order: N/A"
            Case "DE"
                Return "Name: Delaware " & _
                    "Capital: Dover " & _
                    "Admitted: December 7, 1787 " & _
                    "Order: 1"
            Case "FL"
                Return "Name: Florida " & _
                    "Capital: Tallahassee " & _
                    "Admitted: March 3, 1845 " & _
                    "Order: 27"
            Case "GA"
                Return "Name: Georgia " & _
                    "Capital: Atlanta " & _
                    "Admitted: January 2, 1788 " & _
                    "Order: 4"
            Case "HI"
                Return "Name: Hawaii " & _
                    "Capital: Honolulu " & _
                    "Admitted: August 21, 1959 " & _
                    "Order: 50"
            Case "ID"
                Return "Name: Idaho " & _
                    "Capital: Boise " & _
                    "Admitted: July 3, 1890 " & _
                    "Order: 43"
            Case "IL"
                Return "Name: Illinois " & _
                    "Capital: Springfield " & _
                    "Admitted: Decemer 3, 1818 " & _
                    "Order: 21"
            Case "IN"
                Return "Name: Indiana " & _
                    "Capital: Indianapolis " & _
                    "Admitted: December 11, 1816 " & _
                    "Order: 19"
            Case "IA"
                Return "Name: Iowa " & _
                    "Capital: Des_Moines " & _
                    "Admitted: December 28, 1846 " & _
                    "Order: 29"
            Case "KS"
                Return "Name: Kansas " & _
                    "Capital: Topeka " & _
                    "Admitted: January 29, 1861 " & _
                    "Order: 34"
            Case "KY"
                Return "Name: Kentucky " & _
                    "Capital: Frankfort " & _
                    "Admitted: June 1, 1792 " & _
                    "Order: 15"
            Case "LA"
                Return "Name: Louisiana " & _
                    "Capital: Baton_Rouge " & _
                    "Admitted: April 30, 1812 " & _
                    "Order: 18"
            Case "ME"
                Return "Name: Maine " & _
                    "Capital: Augusta " & _
                    "Admitted: March 15, 1820 " & _
                    "Order: 23"
            Case "MD"
                Return "Name: Maryland " & _
                    "Capital: Annapolis " & _
                    "Admitted: April 28, 1788 " & _
                    "Order: 7"
            Case "MA"
                Return "Name: Massachesetts " & _
                    "Capital: Boston " & _
                    "Admitted: February 6, 1788 " & _
                    "Order: 6"
            Case "MI"
                Return "Name: Michigan " & _
                    "Capital: Lansing " & _
                    "Admitted: Jan 26, 1837 " & _
                    "Order: 26"
            Case "MN"
                Return "Name: Minnesota " & _
                    "Capital: St._Paul " & _
                    "Admitted: May 11, 1858 " & _
                    "Order: 32"
            Case "MS"
                Return "Name: Mississippi " & _
                    "Capital: Jackson " & _
                    "Admitted: December 10, 1817 " & _
                    "Order: 20"
            Case "MO"
                Return "Name: Missouri " & _
                    "Capital: Jefferson_City " & _
                    "Admitted: August 10, 1821 " & _
                    "Order: 24"
            Case "MT"
                Return "Name: Montana " & _
                    "Capital: Helena " & _
                    "Admitted: November 8, 1889 " & _
                    "Order: 41"
            Case "NE"
                Return "Name: Nebraska " & _
                    "Capital: Lincoln " & _
                    "Admitted: March 1, 1867 " & _
                    "Order: 37"
            Case "NV"
                Return "Name: Nevada " & _
                    "Capital: Carson_City " & _
                    "Admitted: October 31, 1864 " & _
                    "Order: 36"
            Case "NH"
                Return "Name: New_Hampshire " & _
                    "Capital: Concord " & _
                    "Admitted: June 21, 1788 " & _
                    "Order: 9"
            Case "NJ"
                Return "Name: New_Jersey " & _
                    "Capital: Trenton " & _
                    "Admitted: December 18, 1787 " & _
                    "Order: 3"
            Case "NM"
                Return "Name: New_Mexico " & _
                    "Capital: Santa_Fe " & _
                    "Admitted: January 6, 1912 " & _
                    "Order: 47"
            Case "NY"
                Return "Name: New_York " & _
                    "Capital: Albany " & _
                    "Admitted: July 26, 1788 " & _
                    "Order: 11"
            Case "NC"
                Return "Name: North_Carolina " & _
                    "Capital: Raleigh " & _
                    "Admitted: November 21, 1789 " & _
                    "Order: 12"
            Case "ND"
                Return "Name: North_Dakota " & _
                    "Capital: Bismarck " & _
                    "Admitted: November 2, 1889 " & _
                    "Order: 39"
            Case "OH"
                Return "Name: Ohio " & _
                    "Capital: Columbus " & _
                    "Admitted: March 1, 1803 " & _
                    "Order: 17"
            Case "OK"
                Return "Name: Oklahoma " & _
                    "Capital: Oklahoma_City " & _
                    "Admitted: November 16, 1907 " & _
                    "Order: 46"
            Case "OR"
                Return "Name: Oregon " & _
                    "Capital: Salem " & _
                    "Admitted: February 14, 1859 " & _
                    "Order: 33"
            Case "PA"
                Return "Name: Pennsylvania " & _
                    "Capital: Harrisburg " & _
                    "Admitted: December 12, 1787 " & _
                    "Order: 2"
            Case "RI"
                Return "Name: Rhode_Island " & _
                    "Capital: Providence " & _
                    "Admitted: May 29, 1790 " & _
                    "Order: 13"
            Case "SC"
                Return "Name: South_Carolina " & _
                    "Capital: Columbia " & _
                    "Admitted: May 23, 1788 " & _
                    "Order: 8"
            Case "SD"
                Return "Name: South_Dakota " & _
                    "Capital: Pierre " & _
                    "Admitted: November 2, 1889 " & _
                    "Order: 40"
            Case "TN"
                Return "Name: Tennessee " & _
                    "Capital: Nashville " & _
                    "Admitted: June 1, 1796 " & _
                    "Order: 16"
            Case "TX"
                Return "Name: Texas " & _
                    "Capital: Austin " & _
                    "Admitted: December 28, 1846 " & _
                    "Order: 29"
            Case "UT"
                Return "Name: Utah " & _
                    "Capital: Salt_Lake_City " & _
                    "Admitted: January 4, 1896 " & _
                    "Order: 45"
            Case "VT"
                Return "Name: Vermont " & _
                    "Capital: Montpelier " & _
                    "Admitted: March 4, 1791 " & _
                    "Order: 14"
            Case "VA"
                Return "Name: Virginia " & _
                    "Capital: Richmond " & _
                    "Admitted: June 25, 1788 " & _
                    "Order: 10"
            Case "WA"
                Return "Name: Washington " & _
                    "Capital: Olympia " & _
                    "Admitted: November 11, 1889 " & _
                    "Order: 42"
            Case "WV"
                Return "Name: West_Virginia " & _
                    "Capital: Charleston " & _
                    "Admitted: June 20, 1863 " & _
                    "Order: 35"
            Case "WI"
                Return "Name: Wisconsin " & _
                    "Capital: Madison " & _
                    "Admitted: May 29, 1848 " & _
                    "Order: 30"
            Case "WY"
                Return "Name: Wyoming " & _
                    "Capital: Cheyenne " & _
                    "Admitted: July 10, 1890 " & _
                    "Order: 44"
            Case Else
                Return "The value you entered is not a valid " & _
                    "state abbreviation. Please enter a " & _
                    "valid two-digit abbreviation."
        End Select
    End Function
  10. Now test the XML Web service. In the Project Explorer, select StatesInformation.asmx, right-click, and click Set As Start Page. Press F5. This will build your application and copy the .NET assembly and supporting files to the \bin folder under the virtual root folder on your Web server. Microsoft Internet Explorer will appear with the description of the new XML Web service.


    Figure 1. Description of the XML Web service displayed in Internet Explorer

  11. Click the GetStateInfo hyperlink to test the method. On the page, type a two-digit state abbreviation (such as VA).


    Figure 2. Testing the GetStateInfo method of the XML Web service

  12. Click Invoke. The result is shown in Figure 3.


    Figure 3. The result of the GetStateInfo method

  13. Congratulations! The XML Web service works so now you need to create a client application.

If you created this project on a computer other than the Web server running IIS, you will need to copy the project from the development computer to the Web server hosting the XML Web service (use the folder created in step 1 of the Setting Up Internet Information Server section) and register it on the server by performing the following steps:

  1. On the Project menu, click Copy Project. In the Copy Project dialog box, specify the StatesInfoWS folder under the Web server's root directory, and click OK. All of the files needed for the discovery and use of your XML Web service will be copied to that folder.
  2. To register, click the Start button, point to Run, and type in the following (replace <path> with the absolute path where you copied your DLL):
       regsvr32 <path>\StatesInfoWS.dll

Creating the Client Application

You will now create a form in Access 2002 to call the XML Web service and display the results.

To create this application within Access, you'll need to set a reference to the Microsoft SOAP Type Library (mssoap1.dll) from the References dialog box (Tools menu).

  1. Start Access 2002.
  2. In the Database window, click Forms under Objects, and then click New to display the New Form dialog box.
  3. In the New Form dialog box, select Design View and click OK.
  4. In the View menu, click Properties to open the property sheet for the form.
  5. In the property sheet, change the text in the Caption property to Gets Data from an XML Web Service.
  6. From the Toolbox (View menu), drag a Text Box control onto the form. In the property sheet, change the Name property to txtAbbrevName.
  7. Click the label for the txtAbbrevName control and change the Caption property to Enter the two-digit abbreviation for a state and click Get Information.
  8. From the Toolbox, drag a Command Button control onto the form. Click Cancel in the Command Button Wizard screen. In the property sheet, change the name of the control to cmdGetInfo.
  9. Change the Caption property of the cmdGetInfo control to Get Information. In the property sheet, click the Event tab, click the On Click event, and then click the build button (with the ellipses . . .).
  10. In the Visual Basic Editor, you will first need to add a Web reference to a URL that contains a description of the method available in your XML Web service. On the Tools menu, click Web Service References.
  11. In the Web Service References dialog box, click Web Service URL. In the URL box, type the URL to your XML Web service description file and click Search. For the XML Web service in this demonstration, that would be
  12. In the Search Results box, select StatesInformation. Click the + to expand the node. You can test the method by selecting GetStateInfo and clicking Test.


    Figure 4. The Web Service References dialog box

  13. Click Add. The clsws_StatesInformation class is added under the Class Modules folder. This class acts as a proxy that provides interfaces with the XML Web service and provides a local representation of the XML Web service.
  14. Double-click the clsws_StatesInformation class. As you scroll through the code, you will notice that there are a number of event procedures such as Class_Initialize, Class_Terminate, which were created automatically by the Web Service References tool. You will also notice the wsm_GetStateInfo function, which is used to call the GetStateInfo method of StatesInformation class of the XML Web service you created.
  15. Double-click the form module. Add the following code to the cmdGetInfo_Click event procedure:
        ' Purpose: The procedure is used to test the
        '          sample StatesInformation XML Web
        '          service by calling the wsm_getStateInfo
        '          function of the clsws_StatesInformation
        '          proxy class. This method then calls the
        '          XML Web service sending a two-digit state
        '          abbreviation and displays the return 
        '          information.
        ' Returns: The state full name, the state capital,
        '          the date the state was admitted to the
        '          the union, and the order it was admitted.
        Dim clsStatesWS As clsws_StatesInformation
        Dim strUserInfo As String
        Dim strReturn As String
        Dim strName As String
        Dim strCapital As String
        Dim strDate As String
        Dim strOrder As String
        Dim intStart As Integer
        Dim intEnd As Integer
        Dim intLength As Integer
        On Error GoTo cmdGetInfo_Click_Err
        ' Create a reference to the clsws_StatesInformation class.
        Set clsStatesWS = New clsws_StatesInformation
        strUserInfo = Me!txtAbbrevName.Text
        ' Call the wsm_GetStateInfo method.
        strReturn = Trim(clsStatesWS.wsm_GetStateInfo(strUserInfo))
        ' Check to see if the state information was returned.
        If Left(strReturn, 4) <> "Name" Then
            MsgBox strReturn, , "Not a valid Entry"
            GoTo cmdGetInfo_Click_End
        End If
        ' Parse the return string.
        ' Get the Name field.
        ' Find the first :.
        intStart = InStr(1, strReturn, ":") + 2
        ' Find the first blank after the name.
        intEnd = (InStr(intStart, strReturn, " "))
        ' The number of characters to grab.
        intLength = intEnd - intStart
        strName = Mid(strReturn, intStart, intLength)
        ' Check to see if there is an underscore between
        ' the words and remove it before display.
        If InStr(1, strName, "_") <> 0 Then
            strName = Replace(strName, "_", " ")
        End If
        Me!txtName.Text = strName
        ' Get the Capital field.
        ' Find the second : by starting at the end of
        ' the name field.
        intStart = InStr(intEnd, strReturn, ":") + 2
        ' Find the blank after the date.
        intEnd = (InStr(intStart, strReturn, " "))
        ' The number of characters to grab.
        intLength = intEnd - intStart
        strCapital = Mid(strReturn, intStart, intLength)
        ' Check to see if there is an underscore between
        ' the words and remove it before display.
        If InStr(1, strCapital, "_") <> 0 Then
            strCapital = Replace(strCapital, "_", " ")
        End If
        Me!txtCapital.Text = strCapital
        ' Get the date field.
        intStart = InStr(intEnd, strReturn, ":") + 2
        ' Find the comma after the day and add 6 for
        ' the year.
        intEnd = (InStr(intStart, strReturn, ",") + 6)
        ' The number of characters to grab.
        intLength = intEnd - intStart
        strDate = Mid(strReturn, intStart, intLength)
        Me!txtDate.Text = strDate
        ' And finally, get the order that the state was
        ' admitted to the union.
        strOrder = Trim(Right(strReturn, 2))
        Me!txtOrder.Text = strOrder
        Exit Sub
        MsgBox Err.Number & ":" & Err.Description
        GoTo cmdGetInfo_Click_End
  16. Close the Visual Basic Editor.
  17. From the Toolbox, add four additional Text Box controls to the form, positioning them under the Get Information button.
  18. Double-click the first Text Box control to bring up the property sheet. Change the name of the control to txtName.
  19. Click the label for the control and change the Caption property to Name:.
  20. Repeat steps 18 and 19 for the three remaining controls, changing the following properties:
    Name property for the Text Box controlsCaption property for the associated labels
    TxtDateDate Admitted:
    txtOrderOrder of Admission:
  21. Drag a Command Button control onto the form, positioning it under the txtOrder control. In the Command Button wizard screen, select Form Operations in the Categories list and then select Close Form in the Actions list. Click Next.
  22. In the next screen, select Text and change the text to Close. Click Next.
  23. Change the name of the control to cmdClose and click Finish.

Testing the XML Web Service

Now, open the form and test the XML Web service.

  1. Close the property sheet, if it is displayed.
  2. On the View menu, click Form View.
  3. Type a two-digit state name in the box (for example, VA) and click Get Information.

The results from the XML Web service are displayed in the boxes on the form as displayed in Figure 5.


Figure 5. Access form with the results from the XML Web service


In this article, we demonstrated creating, deploying, and accessing an XML Web service which accepts the two-digit name of a U.S. state and returns the state's full name, its capital, the date the state was admitted to the union, and its order of admission. First, you created a virtual root on the Web server. Next, you created an ASP.NET Web Service project in Visual Studio .NET and then added the code to create the functionality of the XML Web service. Then you created an Access 2002 form as our client application and tested the XML Web service. By using the steps discussed in this article, you can see how easy it is to create, deploy, and test your own XML Web services using Visual Studio .NET and Office XP.