One of the least appreciated standards in the Web services world is Universal Description, Discovery, and Integration - UDDI. The concepts of the UDDI standard are fairly simple - link Web service consumers to providers. If you are a provider, you want to advertise who you are, the nature of your services, and technical information regarding the types of interfaces you provide. For a consumer, you want to be able to quickly look up services according to what type of business you are interested in, the type of service, and other factors.
Like anything these days, what sounds simple gets rather complicated, and as a system developer you need to be an expert in various Web technologies, including HTTP and XML protocols. Luckily, we have development toolkits to make it easier for the average Joe (like me) to get the job done. This review will not only help you understand what the Microsoft UDDI SDK version 2.0 provides, but should also give you a head start to do your own interfacing with UDDI services using .NET.
The UDDI SDK provides all the tools necessary for a .NET developer to interact with a UDDI registry. The examples I'll use in this review will be coded in C#, but with the Command Language Runtime (CLR) architecture of .NET programming in other languages such as Visual Basic will be very similar. In fact, they will use the same assembly components across all languages. The same assembly can also be used from COM clients such as the languages in the Visual Studio 6.0 product.
Installation
Before you install, you'll need to do a quick check of the software prerequisites on your machine. To start, you need to have Microsoft Visual Studio .NET 2003 installed on your machine, along with the 1.1 version of the .NET framework.
The UDDI SDK version 2.0 is included in the Core section of the Microsoft Windows Software Development Kit and instructions for download are available from the UDDI section on Microsoft Developer Network (MSDN). Installation is straightforward: just be sure to include the "Core SDK" components and you should be done in a few minutes. The installation includes an extensive amount of documentation and coding examples, a wizard for publishing services from within Visual Studio .NET 2003, and sample applications that we will cover later. The actual framework code is in the Microsoft.Uddi.dll assembly, located in the bin directory of the Microsoft SDK installation. Run the UddiSdkRegister executable and the assembly will be registered and ready to use.
Finding a Business Partner
Locating a Web service in UDDI starts with finding your business partner in the UDDI repository. For this, the SDK provides the Microsoft.Uddi.FindBusiness object to help you do the search. The object accepts the addition of one or more entries to its "name" property representing the names of the business you are interested in (including wildcards), followed by a call to its Send() method. The call to the Send() method returns a BusinessList object, which may contain one or more business that match your criteria in the "Name" property. Of course, you may not get any back depending on what's listed in the UDDI repository.
Once you have the BusinessList object, you can quickly ascertain whether you had any businesses listed by checking the number of BusinessInfo objects in BusinessInfos collection using the "Count" property (see Listing 1). Now it's just a matter of iterating through each of the BusinessInfo objects to read the business description and other information about the business. One of the "key" data items is the "BusinessKey", which is a globally unique identifier (GUID) used by the UDDI registry to identify the business. UDDI also provides these keys for services, bindings, and a thing called a tModel. All of these keys can be used to work your way down from the top level of the repository (the business name) to the real technical descriptions of the service bindings. UDDI represents this information in a tree-like fashion, and the UDDI SDK is geared to help you navigate easily through the hierarchy to get the data that you need.
Other objects in the SDK help you look up Web services by the service type, binding, and tModel. You may be asking at this point, what is this "tModel" thing? In a nutshell, it's a unique signature defining the service at a very technical level (implementation, platform specific, etc.) that helps Web service consumers who are looking for an exact fit of a producer. It's really up to the business partners to define what that exact fit is but it often equates to an interface definition expressed in the Web Service Description Language (WSDL).
Publishing Your Service
Okay, we've looked at the UDDI SDK's ability to help you look things up in UDDI; what about on the publishing side? Suppose you want your Web service implementation to automatically publish to the UDDI registry when installed, most likely providing the installer or administrator with an interface where they enter the UDDI publishing URL and authentication credentials. And once the system is in place and has its services properly published, you want to provide the capability for the system to maintain the information in the registry, even changing service binding or definitions on a data-driven process. The UDDI SDK has all you need to register your service down to the binding and tModel level. This time, instead of using the SDK objects to navigate through the hierarchy, you will use objects to build the hierarchy (or make modifications to it) level by level.
To begin, we'll need to configure the "UddiConnection" object with the URL of the UDDI server, and enter a user name and password that will be authenticated by the server. In most cases, the URL will use secure HTTP (https://) for the publishing activity. You don't want hackers in there publishing things that you as a business don't support (or worse). Next, you need to create a SaveBusiness object and set the various properties in the object about your business including name, description, and other vital data. Once you're done setting up your business information, you again make a call to the Send() method and wait for a response from the UDDI server (see Listing 2).
One thing I haven't mentioned so far is that the UDDI SDK has an extensive number of exception handling objects to help ascertain whether things are properly published or looked up. All you need to do as a C# developer is to surround the SDK code in a try block and wait to see whether any exceptions are caught during the operation. No catch means everything performed correctly.
Support
That's enough from the API side of things. Here are a few things to keep in mind when using the SDK. First, the UDDI SDK requires that you install the 1.1 version of .NET Framework and Visual Studio .NET 2003, both of which were in final beta at the time of this writing but these can run alongside previous versions.
In addition, the SDK is based on the 2.0 version of the UDDI specification, which is the primary version of the specification that is implemented by the various UDDI server vendors. The UDDI SDK provides a great opportunity to learn all about how UDDI works and offers you practical programming experience interfacing with a UDDI registry. The API set provided in the SDK is easy to pick up and learn. Also, you will find that almost all of the public UDDI registries out there implement the UDDI 2.0 specification, and they are available through the UDDI SDK examples that come with the package.
Finally, you will find several other Microsoft UDDI SDKs out there for download. There is another beta version out for .NET framework 1.0, and a further version for the UDDI 1.0 specification. These are all similar from the programming standpoint but not as comprehensive or as well documented as the version 2.0 release.
Conclusion
There you have it. There is a whole lot more that I didn't cover on the UDDI SDK version 2.0, but you should have enough of the basics from both a programming and UDDI specification standpoint to start you off. The UDDI specification may be the more obscure Web service specification, but nevertheless has enormous potential as a "yellow pages" of sorts for the global Web service world. The UDDI SDK provides a convenient and robust set of programming APIs to help you publish and browse though the book.
Author Bio
Joe Mitchko is a technology specialist working for a leading Internet service company and is product review editor and contributing writer for Web Services Journal.
jmitchko@rcn.com
Microsoft UDDI SDK 2.0 by Joe Mitchko
WSJ Vol 03 Issue 05 - pg.29
Listing 1: C# Code Example for Publishing a Web Service
using Microsoft.Uddi;
using Microsoft.Uddi.Businesses;
// Add the following lines to the Main method:
try
{
// Create a connection to the UDDI node that is to be accessed.
UddiConnection myConn = new UddiConnection(
"http://test.uddi.microsoft.com/inquire",
"https://test.uddi.microsoft.com/publish");
// Create authentication credentials for save operation.
myConn.AuthenticationMode = AuthenticationMode.UddiAuthentication;
myConn.Username = " *** insert your username *** ";
myConn.Password = " *** insert your password *** ";
// Create a named business entity.
BusinessEntity myBiz = new BusinessEntity(" *** insert your business name *** ");
// Use business entity to create an object to save a business.
SaveBusiness sb = new SaveBusiness(myBiz);
// Send the prepared save business request.
BusinessDetail savedBiz = sb.Send(myConn);
// Interpret the returned business detail to examine the
allocated business key.
Console.WriteLine("Business: " + savedBiz.BusinessEntities[0].Names[0].Text);
Console.WriteLine(" Allocated key: " + savedBiz.BusinessEntities[0].BusinessKey);
}
catch (Microsoft.Uddi.UddiException e)
{ Console.WriteLine("UDDI error: " + e.Message); }
catch (Exception gen)
{ Console.WriteLine("General exception: {0}", gen.Message); }
Listing 2: C# Code Example for Finding a Business in UDDI
using Microsoft.Uddi;
// Add the following lines to the Main method:
try
{
// Create a connection to the UDDI node that is to be accessed.
UddiConnection myConn = new UddiConnection
("http://test.uddi.microsoft.com/inquire");
// Create an object to find a business.
FindBusiness fb = new FindBusiness("Fabrikam");
// Send the prepared FindBusiness request over the connection.
BusinessList bizList = fb.Send(myConn);
// Report the summary result.
Console.WriteLine("Found " + bizList.BusinessInfos.Count + " businesses");
}
catch (Microsoft.Uddi.UddiException e)
{ Console.WriteLine("UDDI error: " + e.Message); }
catch (Exception gen)
{ Console.WriteLine("General exception: {0}", gen.Message); }
All Rights Reserved
Copyright © 2004 SYS-CON Media, Inc.
E-mail:
info@sys-con.com