XML Web service discovery is the process by which a client locates an XML Web service and obtains its service description. The process of XML Web service discovery in Visual Studio involves interrogating a Web site following a predetermined algorithm. The goal of the process is to locate the service description, which is an XML document that uses the Web Services Description Language (WSDL). For more information, see XML Web Service Discovery.
The service description or contract, describes what services are available and how to interact with those services. Without a service description, it is impossible to programmatically interact with an XML Web service. For more information, see XML Web Service Description.
Your application must have a means to communicate with the XML Web service and to locate it. Adding a Web reference to your project for the XML Web service does this by generating a proxy class that interfaces with the XML Web service and provides a local representation of the XML Web service. For more information, see Web References.
To add a Web reference
-
On the Project menu, click Add Web Reference.
-
In the URL box of the Add Web Reference dialog box, type the URL to obtain the service description of the XML Web service you want to access, such as http://localhost/TempConvert4/TempConvert4Service.asmx. Then click the Go button to retrieve information about the XML Web service.
- or -
If the XML Web service exists on the local machine, click the Web services on the local machine link in the browser pane. Then click the link for the TempConvert4 XML Web service from the list provided to retrieve information about the XML Web service.
-
In the Web reference name box, rename the Web reference to ConvertSvc, 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. For more information, see How to: Add and Remove Web References.
Visual Studio generates a new header file but does not add it to the project. However, it does save the generated header file to the project folder. The name of the header file depends on the XML Web service you chose to access. This header file is re-generated whenever you build the project. To obtain the correct name of the header file, examine the contents of the Output Window or the Output Window section of the build log (BuildLog.htm in the intermediate files directory). The correct filename appears on a line that resembles the following: /out:ConvertSvc.h. To view the Output Window, on the View menu point to Other Windows and click Output.
For more information, see How to: Add and Remove Web References.