Adding a Web reference when you know the URL of the .asmx file is simple enough. But if you didn't write the Web Service, how do you know the URL? That's where discovery comes in.
When you add a Web reference by typing a URL and clicking Go, the large area in the middle of the Add Web Reference dialog box displays information about the Web Service located at that URL. But before you enter a URL, that area contains useful links to help you find a Web Service:
The first link works with IIS to find Web Services on your own computer. Auxiliary files called discovery documents, with the extension .disco, assist in this process. The other links rely on UDDI, Universal Description Discovery and Integration, to find Web servers that offer Web Services. UDDI is a cross-vendor initiative to publish information about Web Services in a way that can be used from a variety of development environments and operating systems. There are public UDDI servers on the Internet, which hold information about Web Services offered to anyone . You can also set up an enterprise UDDI server, available only to computers on your own network, that holds information about your internal Web Services. There are also test directories for you to experiment with.
Try adding another Web reference to the UseUtilities project. Right-click the References node in Solution Explorer, and choose Add Web Reference. Click the link to Web Services On The Local Machine. You should see all the Web Services you have createdeven those created in languages other than Visual C++. Click the Back button, and then click UDDI directory. Enter a keyword under Service Name and see what's out there. For example, Figure 10.3 shows some of the services registered with UDDI with the word weather in the service name.
Figure 10.3. UDDI helps to find publicly available Web Services.
You can try adding references to these services, reading the WSDL that describes them, or just letting Intellisense show you what objects, methods , and parameters are available to you. Experiment a littleand think of how much work you can save leveraging an existing Web Service instead of writing your own from scratch.