DISCO UDDI -Sandeep Gadde CONTENTS: Web Services What is DISCO? Disco Client Utilities Disco Redirects Dynamic Discovery UDDI UDDI as a better DISCO UDDI Repository UDDI Binding Information UDDI Programmer’s API UDDI - Lite WEB SERVICES Web services are automated information services that are conducted over the Internet, using standardized technologies and formats/protocols that simplify the exchange and integration of large amounts of data over the Internet. Web services platform elements are SOAP, UDDI, WSDL. Web services use XML to code and decode data, SOAP to transport data. CONT.. Web Services basically uses HTTP and SOAP to make business data available on the web and executes remote function calls. SAMPLE WEBSERVICE namespace WebService1 { [WebService(Namespace = "http://tempuri.org/")] public class Service1 : System.Web.Services.WebService { [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public int add(int a, int b) { return a+b; } } } DISCO Web Services discovery is the process of locating and interrogating web service descriptions, which is a preliminary step for accessing a web service. Discovery file is an XML document with a .disco extension and holds the Web Services information. SAMPLE DISCO FILE Service1.disco <disco:discovery xmlns:disco="http://schemas.xmlsoap.org/disco/" xmlns:scl="http://schemas.xmlsoap.org/disco/scl/"> <!-- reference to other DISCO document --> <disco: discoveryRef ref="related-services/default.disco"/> <!-- reference to WSDL and documentation --> <scl:contractRef ref=“Service1.asmx?wsdl“ docRef=“Service1.asmx"/> </disco:discovery> \MyService (root dir) Service1.asmx web.config Service1.disco \bin simpleMath.dll complexMath.dll DISCO CLIENT UTILITIES There are 2 types of client utilities to discover a WebService. - disco.exe tool - Add web ref feature in visual studio.net disco.exe tool is a command line utility provided by microsoft sdk and it is used as follows. c:\>disco.exe http://localhost:85635/MyService/service1.disco CONT.. An output file with name results.discomap is created that contains information about web services discovered at specified URL. It also downloads all the .disco and .wsdl documents that were discovered. Wsdl.exe is the utility to generated web service proxies from WSDL documents or the .discomap files generated by disco.exe . CONT.. results.discomap <?xml version="1.0" encoding="utf-8"?> <DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Results> <DiscoveryClientResult referenceType= "System.Web.Services.Discovery.ContractReference" url="http://localhost/MyService/Service1.asmx?wsdl" filename=“Service1.wsdl"/> <DiscoveryClientResult referenceType= "System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost/MyService/related-services/default.disco" filename="default.disco" /> </Results> </DiscoveryClientResultsFile> CONT.. Add web reference feature in visual studio.net CONT.. CONT.. DISCO REDIRECTS Disco Redirects help to redirect to disco file, if the user doesn’t know the exact address of the disco file. Disco provide hints in the default page of root directory If the root's default page is an HTML document, you can use the LINK tag to redirect the client to the .disco file: <HTML> <HEAD> <link type='text/xml' rel='alternate' href=‘Sample1.disco'/> </HEAD> ••• </HTML> CONT.. If the root's default page is an XML document, you can use the xml-stylesheet processing instruction to accomplish the same thing: <?xml-stylesheet type="text/xml" alternate="yes" href=“Service1.disco"?> DYNAMIC DISCOVERY Dynamic discovery is discovering web services dynamically To enable dynamic discovery, a .vsdisco file like the one shown here must be placed in the desired root. <dynamicDiscovery xmlns="urn:schemas-dynamicdiscovery:disco.2000-03-17“ /> Requests for .vsdisco files are handled by System.WebServices.Discovery.DiscoveryRequestHandler namespace, which dynamically generates a DISCO document based on the resources found in the target root directory. UDDI Universal Description, Discovery and Integration (UDDI) is a specification for building distributed databases that enable interested parties to “discover” each other’s Web services. Provides easy discovery, sharing, and reuse of Web services and other programmable resources. UDDI AS A BETTER DISCO UDDI goes beyond DISCO by defining how to interact with a full-fledged Web Service information repository. UDDI specification consists of a programmer’s API along with an XML schema definition of supporting data structures and messages. UDDI REPOSITORY UDDI repositories contain information about businesses, services, and service bindings as well as additional metadata for categorization purposes. UDDI uses white pages, yellow pages, and green pages to organize information CONT.. White pages include business name, contact info. Yellow pages include categories based on standard taxonomies. Green pages include the technical specifications and references. UDDI BINDING INFORMATION UDDI registry contains 4 main types of information: Business, Services, Binding Templates and tModels. Business-Name, Contact Info, Technical Info of the service. Service-Technical/Business descriptions & categorizations. Each service also exposes binding template info that describes how to connect to and communicate with the given service. UDDI PROGRAMMER’S API UDDI Programmer’s API is divided as Inquiry API and Publishing API. Inquiry API: Provides operations for retrieving information from the registry. Publishing API: Provides operations for publishing information to the registry. INQUIRY API Name Description Find_business This locates information about one or more businesses. Find_service This locates services within a registered businessEntity. Find_binding This locates bindings within a registered businessService. Get_businessDetail This gets businessEntity information for one or more businesses. Get_business DetailExt This gets extended businessEntity information. Get_serviceDetail This gets full details for a set of registered businessServices. Get_bindingDetail This gets bindingTemplate information for making service requests. Get_tModelDetail This gets details for a set of registered tModels. <FIND_BUSINESS> EXAMPLE The following code illustrates how to perform a business lookup by the company's name. <?xml version='1.0' encoding='utf-8'?> <s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <find_business generic="1.0" xmlns="urn:uddi-org:api"> <name>XXX</name> </find_business> </s:Body> </s:Envelope> CONT.. The result of the find_business operation is the info about its services <s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <businessList generic="1.0" truncated="false" operator=“XXX" xmlns="urn:uddi-org:api"> <businessInfos> <businessInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3"> <name>XXX</name> <description xml:lang="en">Empowering people through great software...</description> <serviceInfos> <serviceInfo businessKey="0076B468-EB27-42E5-AC09-9955CFF462A3" serviceKey="D2BC296A-723B-4C45-9ED4-494F9E53F1D1"> <name>UDDI Web Services</name> </serviceInfo> </serviceInfos> </businessInfo> ………… </businessInfos> </businessList> </s:Body> </s:Envelope> . PUBLISHING API Name Description get_authToken Requests an authentication token from an operator site. get_registeredInfo Requests information currently managed by the user. save_business Registers/updates a businessEntity. save_service Registers/updates a businessService. save_binding Registers/updates a bindingTemplate. save_tModel Registers/updates a tModel. delete_business Deletes a businessEntity from the registry. delete_service Deletes a businessService from the registry. delete_binding Deletes a bindingTemplate from the registry. delete_tModel Deletes a tModel from the registry. discard_authToken Discards an existing authentication token. <SAVE_BUSINESS> EXAMPLE <?xml version='1.0' encoding='utf-8'?> <s:Envelope xmlns:s= 'http://schemas.xmlsoap.org/soap/envelope/'> <s:Body> <save_business generic="1.0" xmlns="urn:uddi-org:api"> <!-- retrieved from get_authToken API --> <authinfo>fd3c7a44-118f-413a-a2e3-473a35379993 </authinfo> <businessEntity businessKey="ee3be846-d828-4a38-a5e4-3c33f931d122"> <name>Developmentor</name> <description>Services the developer by... </description> <businessServices> <!-- service descriptions go here --> </businessServices> </businessEntity> </save_business> </s:Body> </s:Envelope> UDDI-LITE Microsoft has come up with UDDI-Lite recently, a compromise between DISCO and UDDI. The idea behind this sample was to provide a centralized web service repository that would be easy to maintain, and would integrate with all of the existing .NET DISCObased tools. CONT.. To implement UDDI-Lite -Web Services are stored in SQL Server DB. -ASP.NET front end to register and unregister Web Services. When client requests .vsdisco file, it automatically generates information stored in SQL Server by mapping requests using System.Web.UI.PageHandlerFactory class. CONT.. SAMPLE CODE TO IMPLEMENT UDDI-LITE <%@ page language="C#" contenttype="text/xml" enablesessionstate="false" %> <%@ import namespace="System.Data" %> <%@ import namespace="System.Data.SqlClient" %> <% Response.ContentType = "text/xml"; %> <disco:discovery xmlns:disco="http://schemas.xmlsoap.org/disco/" xmlns:scl="http://schemas.xmlsoap.org/disco/scl/"> <% SqlConnection conn = new SqlConnection("data source=localhost;initial catalog=uddilite;user id=sa;pwd="); conn.Open(); try { SqlCommand cmd = new SqlCommand("select contract, documentation from contracts"); cmd.Connection = conn; IDataReader reader = null; reader = cmd.ExecuteReader(); while (reader.Read()) { %> <scl:contractRef ref="<%= reader[0].ToString() %> " docRef="<%= reader[1].ToString() %>" /> <% } } finally { conn.Close(); } %> </disco:discovery> CONCLUSION DISCO is ultimately limited by the type and depth of the information that it provides. Microsoft has been heavily involved in the development of UDDI, which is receiving a lot of attention. The bottom line is that DISCO works today and it can help us to get more out of .NET Web Services with little effort. For the future, look for UDDI developments. REFERENCES http://msdn.microsoft.com/en-us/magazine/cc302073.aspx http://www.cs.odu.edu/~mukka/cs795sum10.net/Lecturenotes/d ay4/wsuddi.ppt http://uddi.xml.org/uddi-org THANK YOU