Using an XML Web service
The Walkthrough_Test_WebService project demonstrates how to use an XML Web service that retrieves data from the UniData database. This sample file is found in the \Samples\WebService\Walkthrough_Test_WebService installation directory. The readme.txt file contains step-by-step instructions for running and debugging the program.
Adding the service description
You can use either of the following methods to specify the location of the service description, which is an XML document that uses the Web Services Description Language (WSDL):
Add a service description via the command line.
Add a service description via the Add Web Reference option on the Project menu in Visual Studio .NET.
To add a service description from the command line:
- At the command line, type the following on one line:
wsdl.exe/namespace:UODOTNET http://localhost/ Walkthrough_WebService/Service1.asmx?wsdl
This command creates a C# (Service1.cs) file that contains the proxy code to access the public methods exposed by the XML Web service.
- Compile this C# file by using the
csc execommand. - Compile the C# program into a DLL that will be used by the ASP.NET
application, as follows:At the command line, type
the following on one line:
csc /t:library /r:System.Web.Services.dll/out:bin/ u2xmlservice.dll Service1.cs
This command creates a proxy DLL. The application locates the DLL in the bin directory and loads the library automatically.
To add a service description from the Add Web Reference option:
- Start Visual Studio .NET.
- On the Project menu, click the Add Web Reference option.The Add Web Reference dialog box appears.
- In the URL text box, type http://localhost/Walkthrough_WebService/Service1.asmx and then click the Go button to retrieve information about the XML Web service.
- In the Web reference name box, rename the Web reference to
UODOTNET, which is the namespace you will use for this Web reference. - Click Add Reference to add a Web reference for the target XML Web service.Visual Studio .NET downloads the service description and generates a proxy class to interface between this application and the XML Web service.