Using Web Services

Team-Fly    

Developing XML Web Services and Server Components with Visual C#™ .NET and the .NET Framework, Exam Cram™ 2 (Exam 70-320)
By Amit Kalani, Priti Kalani

Table of Contents
Chapter 5.  Basic Web Services


Because Web services aren't installed on your computer, you need some way to determine the messages that they accept and the services that they provide. The usual term for this process is discovery, which encompasses both finding Web services and determining their interfaces. To discover Web services, you use Disco, UDDI, and WSDL.

Discovering Web Services with Disco and UDDI

Disco is a Microsoft standard for the creation of discovery documents. A Disco document is kept at a standard location on a Web services server and contains paths and information for retrieving other useful information, such as the WSDL file that describes a service. Disco is generally not used outside the .NET world.

For Visual Studio .NET projects, you ordinarily won't want to build a Disco document. Such projects are designed to generate discovery information from their base URL. For example, if your Web service is named StringProc and is stored on a server with the name INFINITY, and has a base class name of Strings.asmx, you can retrieve static discovery information by navigating to http://INFINITY/StringProc/Strings.asmx?wsdl.

Sometimes, though, you want to generate a completely static discovery document that does not require processing to create. A sample static discovery document would appear as follows:

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

Universal Description, Discovery, and Integration (UDDI) is a method for finding services by referring to a central directory. These can be Web services, URLs for information, or any other online resource. UDDI registries are sites that contain information that is available via UDDI; you can search such a registry to find information about Web services.

UDDI registries come in two forms: public and private. A public UDDI registry is available to everyone via the Internet, and it serves as a central repository of information about Web and other services for businesses. A private UDDI registry follows the same specifications as a public UDDI registry, but it is located on an intranet for the use of workers at one particular enterprise.

graphics/note_icon.gif

The UDDI specification is being developed jointly by several industry partners, including Microsoft and IBM. For more information and a public directory, visit www.uddi.org.


Using the Web Services Discovery Tool (disco.exe)

When you set a Web reference in Visual Studio .NET, the software automatically handles the discovery details for you. But you can get into the details of the process yourself, if you want. One of the tools included in the .NET Framework SDK (and also in Visual Studio .NET) is the Web Services Discovery tool, disco.exe. This is a command-line tool that assists you in the discovery process. Enter the following command at the Visual Studio .NET command prompt to discover the details of the CapeScience Airport Weather Web service:

 disco http://live.capescience.com/wsdl/AirportWeather.wsdl. 

The disco.exe tool contacts the Web service and (in this case) creates two files of results: AirportWeather.wsdl and results.discomap. The resulting .discomap file is an XML file that shows you the name of the other file (AirportWeather.wsdl) and the URL from which its contents were retrieved. The AirportWeather.wsdl file is an XML file that contains information about the Web service's interface, including details about the messages, parameters, and objects with which you can interact. This file gives Visual Studio .NET the details it needs to allow you to use a Web service.


    Team-Fly    
    Top


    MCAD Developing XML Web Services and Server Components with Visual C#. NET and the. NET Framework Exam Cram 2 (Exam Cram 70-320)
    Managing Globally with Information Technology
    ISBN: 789728974
    EAN: 2147483647
    Year: 2002
    Pages: 179

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