UDDI

DISCO

The mere name generates visions of John Travolta strutting his stuff in a polyester leisure suit. DISCO, which is short for Discovery, is yet another technology that you can use to advertise and discover Web services.

The DISCO protocol was developed by Microsoft, which currently has no formal plans for submitting the DISCO specification to a standards body. So, if we have UDDI, why DISCO?

Recall that UDDI is a structured, centrally managed directory service. Its ability to discover Web services is company-centric. It is difficult to query UDDI to determine what Web services are exposed by a particular server. For this type of query, you need a more decentralized mechanism for locating Web services.

DISCO allows you to discover the Web services running on a particular computer by providing a browse paradigm for locating a particular Web service. In some respects, DISCO is similar to the hyperlink navigation popularized by HTML. You can advertise a top-level index that contains references to specific Web services or to other DISCO files.

Because DISCO supports a browse paradigm, it is well suited to development environments. And because DISCO does not require you to formally register with UDDI, you can quickly expose your Web services to other developers. Developers can browse your development server to discover the URL of a particular Web service that they need to code against.

Visual Studio .NET and DISCO

By default, the Visual Studio .NET Add Web Reference Wizard uses DISCO files to locate Web services. However, you will probably want something other than a DISCO file to serve as the default page of your Web server.

Even if the Web site hosts only Web services, the default page will prob ably contain HTML documentation. Therefore, during the installation of Visual Studio .NET, a link HTML tag is placed within the default page of the Web server. Here is an example:

<HTML> <HEAD> <link type='text/xml' rel='alternate' href='Default.vsdisco'/> </HEAD> <BODY> Welcome to my Web site! </BODY> </HTML>

If the default page of the Web site is an XML document, you can add an xml-stylesheet processing instruction. Here is an example:

<?xml version="1.0" ?> <?xml-stylesheet type="text/xml" alternate="yes" href="Default.disco" ?> <MyXmlDocument>Test</MyXmlDocument>

For the most part, Visual Studio .NET automatically creates the necessary DISCO files for you. During installation, Visual Studio .NET will automatically create a DISCO file for the default Web server.

Here is an example of the DISCO file created for a Web service project:

<?xml version="1.0" ?> <dynamicDiscovery xmlns="urn:schemas-dynamicdiscovery:disco.2000-03-17"> <exclude path="_vti_cnf" /> <exclude path="_vti_pvt" /> <exclude path="_vti_log" /> <exclude path="_vti_script" /> <exclude path="_vti_txt" /> </dynamicDiscovery>

The DISCO file named Default.vsdisco is placed in the root directory of the Web server. All files hosted on Microsoft Internet Information Server (IIS) that contain the .vsdisco file extension will be handled by DiscoveryRequestHandler within ASP.NET. However, DiscoveryRequestHandler is disabled by default. To enable discovery support within your ASP.NET application, add an entry similar to the one below to the httpHandlers section of your web.config file. You can also apply the setting machine-wide by editing your machine.config file.

<httpHandlers>   <add verb="*" path="*.vsdisco"    type="System.Web.Services.Discovery.DiscoveryRequestHandler,    System.Web.Services, Version=1.0.3300.0, Culture=neutral,    PublicKeyToken=b03f5f7f11d50a3a" validate="false"/> </httpHandlers>

DISCO files that contain the dynamicDiscovery element will prompt the ASP.NET ISAPI filter to search the immediate directory for all files containing an .asmx extension and to search all subdirectories for all files with a .vsdisco extension. Any path listed with an exclude element will be ignored.

For example, suppose the dynamic discovery file was generated on a server named DEVELOPMENT. The server will host the Invoice Web service in a subdirectory by the same name. In this case, the resulting DISCO file is as follows:

<?xml version="1.0" encoding="utf-8"?> <discovery xmlns="http://schemas.xmlsoap.org/disco/">   <discoveryRef ref="http://DEVELOPMENT/Invoice/Invoice.vsdisco" /> </discovery>

The DISCO document contains a discoveryRef element for each DISCO file it finds within its subdirectories. This element is similar in purpose to an HTML HREF. The client can follow the link to drill down further.

When Visual Studio .NET creates a Web services project, it creates a DISCO file. This file is given the same name as the project and a .vsdisco extension. The following are the contents of the Invoice.vsdisco file:

<?xml version="1.0" ?> <dynamicDiscovery xmlns="urn:schemas-dynamicdiscovery:disco.2000-03-17"> <exclude path="_vti_cnf" /> <exclude path="_vti_pvt" /> <exclude path="_vti_log" /> <exclude path="_vti_script" /> <exclude path="_vti_txt" /> <exclude path="Web References" /> </dynamicDiscovery>

The contents of the Invoice.vsdisco file are similar to those of the Default.vsdisco file except that they exclude the Web References directory. When a client accesses the file, this DISCO file is dynamically generated:

<?xml version="1.0" encoding="utf-8"?> <discovery xmlns="http://schemas.xmlsoap.org/disco/">   <contractRef ref="http://DEVELOPMENT/Invoice/Invoice.asmx?wsdl"    docRef="http://DEVELOPMENT/Invoice/Invoice.asmx"    xmlns="http://schemas.xmlsoap.org/disco/scl/" /> </discovery>

The resulting DISCO document contains a single contractRef element that contains a reference to the WSDL document and the HTML documentation for the Web service.

Because it is expensive to perform a directory scan each time a dynamically generated DISCO file is accessed, you can opt to expose a static DISCO file instead. The easiest way to create a static DISCO file is to replace the file with the results of the dynamically generated DISCO file. For example, you might do this on heavily accessed development servers or before the Web service is deployed to production.



Building XML Web Services for the Microsoft  .NET Platform
Building XML Web Services for the Microsoft .NET Platform
ISBN: 0735614067
EAN: 2147483647
Year: 2002
Pages: 94
Authors: Scott Short

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net