Helping Other Programmers Discover Your Web Services

After you place a web service on the Web, your service will only be useful to others if they know the service exists. Programmers refer to the process of locating a web service as discovery, or more simply, disco. Through the web service discover process, other programmers not only locate web services, but in addition they can determine the methods the service provides as well as specifics about the parameters their programs must pass to each method.

Throughout this book, you have placed the characters ?wsdl after the address of a web service to display the service’s WSDL entries. In a similar way, you can use the characters ?disco to display a service’s discovery entries. For example, to display the discovery entries for the CalculateMortgage web service that you created in Chapter 4, “Looking Behind the Scenes at Web Service Protocols,” you would specify the URL http://localhost/CalculateMortgage/ Service1.asmx?disco, as shown in Figure 6.10.

click to expand
Figure 6.10: Appending the characters ?disco to a web service address to display the service’s discovery entries

A web service’s discovery (disco) entries consist of five key parts, each of which Table 6.2 describes.

Table 6.2:  The Five Key .disco Entries That Programs Can Use to Discover Web Services

Entry

Purpose

<contractRef>

Defines the location of the service’s WSDL schema

<discoveryRef>

Expands the service’s discovery capabilities by letting a programmer specify additional .disco entries for related services

<schemaRef>

Attaches an XML schema definition to the .disco file

<soapRef>

Provides the web service’s binding information in a lightweight form that a client can quickly put to use

<webServiceDescription>

Provides a reference to additional documentation files

Using a web service’s disco entries, a program (remote client) can scan through services in pursuit of a specific capability, much like a search-engine robot program can retrieve files from across the Web in pursuit of sites that discuss a specific topic. In general, after the program retrieves the .disco information, the program can use the entries to locate specifics (and additional documentation) about the service.

When you create a web service within the .NET environment, Visual Studio .NET will create a file with the .vsdisco file extension. As it turns out, the .disco entries describe a specific .asmx file. A .vsdisco file, in contrast, describes the web services used by each file within a project. By default, the .vsdisco file will contain the following entries:

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

In this case, the file’s entries specify directories that a program should exclude from its discovery operations.

Programmers often refer to the .vsdisco file as a dynamic discovery file. In theory, when a remote client asks a server to provide discovery information, the server will create the .vsdisco file that contains information about each .disco file found in the location the remote client specifies. In practice, Visual Studio .NET creates the .vsdisco file.




. NET Web Services Solutions
.NET Web Services Solutions
ISBN: 0782141722
EAN: 2147483647
Year: 2005
Pages: 161
Authors: Kris Jamsa

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