ASP.NET Web Page with Visual Studio.NET

Discovery and .NET

An important part of Web Services is providing a means of discovery so that developers can easily find the functionality they need and may want to purchase. UDDI is part of the discovery process discussed in Chapter 5 and many features in Microsoft’s .NET environment are an attempt in helping you with this process.


Disco is a command line tool that comes bundled with the .NET Framework SDK. If a site is set up properly, you can point the tool to a particular site and get a list of available Web Services. To enable this feature on your Web site that possesses Web Services, you need to modify your index.html file with the following information in the HEAD HTML tag, as shown in the following code.

    <HEAD>        <link type='text/xml'              rel='alternate'              href='default.disco'/>     </HEAD> 

This small piece of meta information tells the disco command line tool where your discovery document (disco document) resides on your system. The rel attribute indicates that the disco document is available via a relative link and not on another Web site. The HREF directive indicates where the disco document resides on a particular system.

A disco file is simply an XML document that resides on your system and contains Web Services that you want others to discover in this manner.


Note that the disco XML format is a creation of Microsoft and not part of any of the standards discussed in earlier chapters.

Now go out to the DOS prompt in Windows and ensure that your .NET environment is set up properly by either already having the environment set up in DOS or by executing corvars.bat. Then you can execute the following command.

    disco http://localhost/Default.disco /nosave

This reveals the available disco documents on the system. In this case, the response should look something like the following.

    Microsoft (R) Web Services Discovery Utility     [Microsoft (R) .NET Framework, Version 1.0.3705.0]     Copyright (C) Microsoft Corporation 1998-2001. All     rights reserved.     Disco found documents at the following URLs:     http://localhost/Default.disco

Because the disco file is an XML document, you can use Internet Explorer to view the XML to reveal the available Web Services on a particular machine that utilizes disco. Figure 6.17 displays Internet Explorer viewing the disco file.

click to expand
Figure 6.17: The disco file shown in Internet Explorer.

The XML file reveals to your user the location of a Web Service on your system.


With UDDI becoming more popular, the concept of Microsoft’s disco tool becomes moot. UDDI provides a better interface to discovery and even provides you with the means to communicate with the repository through an API.

Web References, UDDI, and Visual Studio.NET

Within Visual Studio.NET, adding a Web reference provides you with an easy means of discovery. This tool integrates with to help you find various Web Services. Utilizing it is a matter of clicking on the “Add Web Reference” selection in the “Project” menu of Visual Studio.NET.

By adding a Web reference, Visual Studio.NET creates the proxy for you and this is compiled with the entire project. Remember that with SDK the proxy had to be created manually.

In previous examples in this chapter, the “Add Web Reference” dialogue was used by adding a reference to a Web Service residing on the local machine. This tool is also useful for finding Web Services on the Web. Figure 6.18 shows the initial dialogue that appears. Notice on the lefthand side that you can search by service provider name.

click to expand
Figure 6.18: Searching for a Web Service using the “Add Web Reference” dialogue in Visual Studio.NET.

Enter “Stock Quote” as the name of the service name. You will see results similar to those shown in Figure 6.19.

Now click on a link to the to the WSDL file in the listing for one of the stock quote Web Services. You’ll see that the WSDL looks similar to what appears in Figure 6.20.

click to expand
Figure 6.19: The results of searching for “Stock Quote” in the “Add Web Reference” dialogue.

click to expand
Figure 6.20: The WSDL file for one of the stock quote Web Services found in the “Add Web Reference” dialogue box.

Then you can simply create the Web reference for your project.

Using UDDI Alone

Remember from Chapter 5 that you don’t have do use the Microsoft tools to find the Web Service you need. There are several UDDI Web sites that offer UDDI services. So don’t forget about using these directly.


Even though UDDI and WSDL share no formal relationship, WSDL is still part of the discovery process. The WSDL tool provides you with the ability to create proxies for your projects that are made with the Framework SDK. Remember that UDDI and WSDL do not share any formal relationship, but utilizing both standards is important for discovering the service and then discovering which methods are available.

The use of the WSDL tool is discussed in detail earlier in this chapter, when the creation of the proxy is discussed.

Cross-Platform Web Services Using C# and Java
Cross-Platform Web Services Using C# & JAVA (Charles River Media Internet & Web Design)
ISBN: 1584502622
EAN: 2147483647
Year: 2005
Pages: 128 © 2008-2017.
If you may any questions please contact us: