Creating a Discovery File
Once you have created a web service, there must be some way for the developers who will develop the consuming applications to find out about the methods exposed by the web service. This process is called discovery.
The description of the web service is contained in a service description document, an XML document written in a format called WSDL (Web Service Description Language). You have already seen the WSDL document for our example web service in this chapter, in Figure 16-2. There are two ways to view a WSDL document.
The first is to enter the URL of the web service
.asmx
file in a browser to generate the web
service test page, as shown in several of the figures in this
chapter, including Figure 16-4 and Figure 16-12. Near the top of the test page will be a link
to a Service Description. Clicking on that link will bring up the
WSDL document.
Alternatively, enter the URL for a web service
.asmx
file in a browser with
?WSDL
appended to the end of the URL. For
example, entering the following URL in a browser would display the
WSDL for the web service csStickTicker.asmx
:
http://localhost/ProgAspNet/csStockTicker.asmx?WSDL
To ease the chore of generating a WSDL document for the developer
creating the consuming application, you can create a
.disco
file. This is an XML file located in the
same virtual directory as the .asmx
file. The
developer creating the consuming application can then use the
.disco
file, as will be demonstrated shortly.
Example 16-29 shows a ...
Get Programming ASP.NET, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.