Microsoft & .NET.NETEnterprise UDDI Services

Enterprise UDDI Services

Windows Server 2003 ships with Enterprise UDDI Services, a dynamic and flexible infrastructure for discovering and integrating Web services within your application. Enterprise UDDI Services is a standards-based solution that can be used to run your own UDDI (Universal Description, Discovery, and Integration) directory for intranet or extranet use, making it easier to discover Web services and other programmatic resources. By providing a centralized repository of Web services, Enterprise UDDI Services makes it possible for the developers to easily and quickly find and reuse the Web services available within the organization, allowing them to build and deploy extensible and reliable applications. In this article, we will understand the features of this new capability and demonstrate how it can be used to register and discover Web services. Along the way, we will also see how Enterprise UDDI Services can be accessed from a Web user interface as well as programmatically through the UDDI API.

Introduction

Enterprise UDDI Services helps companies organize and catalog Web services and other programmatic resources. By applying categorization schemes such as geography, Quality of Service (QoS), or organization in UDDI Services, companies can establish a structured and standardized way to describe and discover services. Enterprise UDDI Services in Windows Server 2003 is fully compliant with UDDI 2.0 specification. UDDI Services store both the technical information to build an application compatible with a Web services interface, as well as the information required to successfully connect to the Web service at run time.

The most common scenarios for Enterprise UDDI Services inside an organization are as follows:

  • Developer Reuse—At design time, developers search UDDI Services for Web services and other programmatic resources to reuse in building new applications. UDDI Services exposes all of the information needed to invoke a service, making it easy for the developer to integrate the service into an application. UDDI Services provides developers with a central repository of service description and technical binding information, making it easier to reuse existing services and publish new services based on standard and custom categorization schemes. Because of the seamless integration with Visual Studio .NET and the Office Web Services Toolkit, UDDI Services enables developers to locate and reuse Web services directly from within their application development environment.
  • Dynamic Application Configuration—It is also possible to use UDDI at runtime to get the binding information about a Web service and then connect to the service directly. An example of this is a stock broker application that queries UDDI Services first thing in the morning to get configuration information for the different services that are part of the application, such as a stock ticker, or customer service updates.

Installing UDDI Services

When you install Windows Server 2003, it does not install Enterprise UDDI Services by default. To install Enterprise UDDI Services, Select Start->Control Panel->Add Remove Programs. From the Add Remove Programs dialog box, when you click Add/Remove Windows Components, you will be provided with the following dialog box.

In the above dialog box, select UDDI Services from the list of options to install the Enterprise UDDI Services component in your server.

Enterprise UDDI Services Architecture

UDDI Services is a managed code service in Windows Server 2003, meaning that it is completely written using .NET managed code. Enterprise UDDI Services was built using the Microsoft .NET Framework 1.1 and was designed to be hosted in IIS 6.0. The following diagram shows the architecture of Enterprise UDDI Services.

As you can see from the above diagrams, you can leverage UDDI Services either through a Web-based user interface or programmatically through a SOAP interface. The important components of the UDDI Services are:

  • Clients: There are two types of clients—Browser clients and Web service clients. The browser clients can navigate to the ASP.NET Web pages that are available once you install the Enterprise UDDI Services component in your machine. This Web-based interface provides capabilities for searching, publishing, and coordination features that are compatible with browser clients such as Internet Explorer 4.0, or later, and Netscape Navigator 4.5, or later. The Web service clients can directly invoke the Web services exposed by the Enterprise UDDI Services.
  • UDDI Request Manager: UDDI request manager receives the incoming requests from the ASP.NET pages or the Web service classes and invokes the appropriate methods of the UDDI class library.
  • UDDI Class Library: This class library is a core component that encapsulates all of the functionalities required for interacting with the database server.
  • Database Server: As the above diagram shows, you can host the database either in MSDE or SQL Server depending on the scalability requirements for your enterprise. By default, UDDI Services uses MSDE as the data source.

Now that we have had an overview of the different components of Enterprise UDDI Services, let us consider an example in which we will publish a Web service with UDDI through the Web interface and then programmatically query the UDDI Services and get information about the registered Web service.

Web Services Publishing with UDDI

In this section, we will walk through the steps involved in publishing a Web service with the UDDI interface. Before we move on to look at that, let us outline the development steps one has to follow before publishing a Web service with UDDI.

  • Developer creates the core functionality of the service.
  • Writes a SOAP wrapper for the core functionality.
  • Creates a WSDL service description. It is often possible to do this using an automated service.
  • Install the Web service on a new or existing Web server.
  • Publish the specifications of the Web service with Enterprise UDDI Services.

In this section, we will use the UDDI Web interface for publishing the Web service in the Enterprise UDDI Services. For the purposes of this example, we will publish a Web service named http://localhost/MyProjects/SimpleWebService/HelloService.asmx in the Enterprise UDDI Services using the Web-based user interface. Let us start by navigating to the Enterprise UDDI Services default Web site by typing in http://localhost/uddi in the Internet Explorer address bar. If you have enabled SSL when installing UDDI Services, this URL will obviously be https://localhost/uddi.

  • Click the Publish hyperlink in the home page. In the resulting page, click on the Providers tab and add a new Provider by clicking on the Add Provider command button.
  • Once you add a new provider, it should look like the following. In this example, we have added a new provider named MyProvider.
  • If you click View in the above screen, you will be taken to the following screen where you can optionally specify information such as Contacts, Identifiers, Discovery URLs, Relationships, and so on. We will just add the Categories information for this provider to associate the provider with the specific category.
  • In the above screen, click on the Categories tab and Select Categorization scheme by clicking on the Add Category command button. For this example, we will specify the categorization scheme as uddi-org:types and then select Categorization (taxonomy) as the subcategory.
  • After adding the categories information, the output should look like the following.
  • Now that we have associated the Categorization scheme for the provider, let us publish a Web service by clicking on the Services tab in the above screen.
  • In the Services screen, click on the Add Service to publish our new Web service. When you do this, by default, it will create a service named (New Service Name). Click on the Edit command button to change the name of the service. For this example, we will call the name of the service Simple Service. After adding the service name, you can also optionally add a description for the service. After adding the above information, you should see the following screen.
  • Now that we have defined the service, we can now go ahead and specify an access point (location of the Web service) or the binding information for the service. To do this, click on the Bindings tab in the above screenshot and then click on the Add Binding command button to specify the access point for the Web service. For this example, we will specify the access point as http://localhost/MyProjects/SimpleWebService/HelloService.asmx.
  • After specifying the Web service access point, you can also optionally add a description about the Web service.
  • The final step is to add the instance information or a tModel (that provides technical information, such as instance parameters, or links to programmatic descriptions) for the Web service. Before you can associate a tModel with the web service, you need to create the tModel. To create a new tModel, click on the tModels node in the treeview. In the displayed screen, click on the Add tModel command button, and then specify all the required information. For the purposes of this example, we will create a new tModel named Simple Service tModel. Once you create a new tModel, the output should look like the following.
  • Now that we have created the tModel, we can associate the tModel with the access point of the Web service. To do this, click on the Instance Info tab and then click on the Add Instance Info command button to add the instance. When you do that, you will be provided with a screen wherein you can search for a tModel with the specific name. In the search textbox, enter “Simple” as the search string and click on the Search command button and you will get the following output.
  • In the above screen, click on the Simple Service tModel hyperlink to associate the tModel with the access point.

That’s all there is to publishing a Web service with the Enterprise UDDI Services.

Web Services Discovery with UDDI

As mentioned before, apart from using the Web-based interface provided by the Enterprise UDDI Services to register/query Web services, you can also use the programmatic API for performing the same set of operations. In this section, we will take a look at an example application that uses the UDDI SDK for querying the Enterprise UDDI Services to search for a specific Web service. Before we take a look at the code required to implement this, let us understand the role of UDDI Services in the development steps that one will follow for consuming a Web service.

  • A Web services consumer seeks an application functionality that is provided by another application. The consumer can use the UDDI discovery methods provided by the Enterprise UDDI Services.
  • Consumer searches the Enterprise UDDI Services for the desired functionality. The consumer can do this programmatically or declaratively.
  • After locating the required Web service, the consumer retrieves the WSDL service description using the information found on the Enterprise UDDI services.
  • The consumer then creates a client application, which uses SOAP messaging, from the WSDL service description.
  • Run the client application that will connect to the Web service.

Let us start by creating a new Visual C# Windows Application named UddiQueryExample. Once the project is created, we will add a label control, a command button, and a textbox to the form and name them lblSearch, btnSearch, and txtName, respectively. Because we are going to be using the UDDI SDK for querying the Enterprise UDDI Services, you also need to download and install the UDDI SDK. Once installed, you can then reference it from within the project by using the Add Reference option from Visual Studio.NET.

After that, add the following lines of code to import the required UDDI namespaces.

using Microsoft.Uddi;
using Microsoft.Uddi.Services;
using Microsoft.Uddi.TModels;

Then, modify the Click event of the btnSearch control to look like the following.

private void btnSearch_Click(object sender, System.EventArgs e)
{
  try
  {
    // Create a connection to the UDDI node that is to be accessed.
    UddiConnection conn = new
      UddiConnection("http://localhost/uddi/inquire.asmx");
    // Create an object to find a business.
    FindService fs = new FindService(txtName.Text);
    // Send the prepared FindBusiness request over the connection.
    ServiceList servList = fs.Send(conn);
    // Display the service name and unique identifying key.
    foreach (ServiceInfo servInfo in servList.ServiceInfos)
    {
      MessageBox.Show("Service: " + servInfo.Names[0].Text + "
        " + servInfo.ServiceKey);
    }
  }
  catch (Microsoft.Uddi.UddiException ex)
  {
    MessageBox.Show("UDDI Exception: " + ex.Message);
  }
  catch (Exception gen)
  {
    MessageBox.Show("General Exception: " +  gen.Message);
  }
}

Let us walk through the above lines of code. We start by creating an instance of the UddiConnection object and specifying the Inquire Web service of the Enterprise UDDI Services to the constructor of the UddiConnection object. Then, we create an instance of the FindService object, passing in the keyword of the Web service to search. Then, we invoke the Send method of the FindService object, passing in the previously created UddiConnection object as an argument. The Send method returns the list of available services in the form of a ServiceList object. The ServiceList object exposes a property named ServiceInfos that basically returns an array of ServiceInfo objects.

Once we have a reference to this array, we then manually loop through all the individual elements in the array and display them in the message box. If there is an exception while executing the try block, the control is then transferred to the catch block where we catch both the UDDI specific exceptions as well as general exceptions. If you execute the code by pressing F5, and then enter “Simple Service” in the search textbox, the code will invoke the Enterprise UDDI Services Inquire Web service and display information about the Web service named “Simple Service” that we created in the previous section. To download and install the UDDI SDK, please go to the following MSDN link (http://msdn.microsoft.com/library/default.asp?url=/downloads/list/websrvuddi.asp).

Enterprise UDDI Services Usage Scenarios

There are several common business scenarios that will benefit from the Enterprise UDDI Services. These scenarios fall into two categories:

  • Performing inquiries to find information about services offered—Here you can use the features supplied by the UDDI SDK to programmatically query UDDI for Web services or you can also directly go to the Enterprise UDDI Services Web interface and search for available Web services that meet your criteria.
  • Registering software that uses Web services—The main purpose of the UDDI registry is to let others know you exist and that you have Web services exposed that can be used to interact with your business. Common examples of these services will be for business document interchange—for documents such as purchase orders, invoices, shipping notices, and so forth. Depending on the tools and products you use to manage your exposed services, you’ll want to use the UDDI registry to advertise technical information about your service.

Many times, software will need to interact with a UDDI registry to find out information about Web services exposed by existing or potential business partners. For example, given a choice between two potential partners that offer equivalent goods or services, a business might choose the one that already has compatible software. Sometimes, the business need is to locate a service that you can use, regardless of the business that provides it. For a certain class of base services, such as ticker price, time check, or basic math calculations, any good implementation of a well-known service will suffice. For these types of service requests, software may simply want to find an available implementation of a service that implements a particular widely used specification, and invoke it. By using Enterprise UDDI Services, you can enable these kinds of scenarios.

For the developers, Microsoft offers UDDI client support through several tools including Visual Studio .NET, the Office XP Web Services Toolkit, and the UDDI software development kit (SDK). Microsoft Visual Studio .NET provides native support for UDDI Services through “Add Web Reference,” enabling developers to easily discover Web services and other programmatic resources in UDDI for use in building dynamic applications.

Download of Files

Conclusion

As you can see, Enterprise UDDI Services allows organizations to manage their Web services by making them available in a centralized location that can be easily searched. And for the developers, now they have an easy way to search for Web services, and reuse them by leveraging the rich client-side support offered by various Microsoft tools. This can improve developer and IT productivity, resulting in lower total cost of ownership (TCO) and more reliable and manageable applications.

About the Author

Thiru Thangarathinam has six years of experience in architecting, designing, developing, and implementing applications using Object Oriented Application development methodologies. He also possesses a thorough understanding of the software life cycle (design, development, and testing). He holds several certifications, including MCAD for .NET, MCSD, and MCP. Thiru is an expert with ASP.NET, .NET Framework, Visual C# .NET, Visual Basic .NET, ADO.NET, XML Web Services, and .NET Remoting and holds. Thiru has authored numerous books and articles. He can be reached at thiruthangarathinam@yahoo.com.

# # #

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Latest Posts

Related Stories