The Universal Description, Discovery, and Integration (UDDI) specification outlines the structure (i.e., the syntax and semantics) for the Web Services equivalent of the yellow pages. Businesses can register their Web Services in the UDDI business registry and, in doing so, let partners and anyone else who knows and supports UDDI easily find the Web Services they need. With UDDI, Web Services descriptions exist in one place that provides a standard interface for query and storage. The UDDI software development kit (SDK) supplies API functions that let you interact with the UDDI registry directly from a COM-based program.

Strictly speaking, you don't need UDDI to issue calls to remote or local Web Services. As I demonstrated in my previous two columns, you can call a Web service if you know its URL and use a particular Simple Object Access Protocol (SOAP)-based format to make an HTTP request. UDDI has very little to do with any calling protocol you might use.

Likewise, you don't need the UDDI SDK for many Web Services scenarios. In particular, you don’t need to be acquainted with UDDI to write a Visual Basic.NET (VB.NET) or a C# Web service. Nor do you need it if you want to access a given service as a client. In any circumstance where you know everything you need about a Web service, you simply don’t need UDDI and its SDK.

So when can the UDDI SDK really benefit you? The UDDI SDK is useful when you need to know about the specific services that partners participating in the UDDI program offer and when you're preparing your own information so that others can link to it and work with you. For example, if you want to share a Web service with partners or use it to generate revenue, UDDI can help. You can also use UDDI to write an offline application that manages the UDDI registry, caches data locally, and maintains the settings for your Web Services. Such a management application isn't necessary for developing Web Services, but any successfully developed Web control can take advantage of it.

Before you can publish data to the UDDI registry, you need to register with the UDDI server and obtain valid credentials—typically a username and a password. The UDDI SDK includes objects that can help you manage Web service registrations. You can also register when you set up any application that's UDDI-compliant and that requires you to use and advertise special Web Services.

The UDDI registry uses XML messages with a SOAP layout to communicate with potential client programs. Because the messages use a SOAP-based format, they consist of an envelope portion and a body. The envelope objects in the UDDI SDK take care of the raw SOAP details, including the request/response processing and byte transportation. The message objects provide an object-based programming interface that lets you send and receive the request and response data you want to exchange with the UDDI registry.

When you work with UDDI, a key object is the RequestManager, which, in VB 6.0, you declare using the following syntax:

Dim r As New UDDIEnv.RequestManager

Of course, for this code to work, you must have imported the necessary type libraries for envelopes and messages. By default, the RequestManager connects to the UDDI registry's production instance at the Microsoft Web site \[http://uddi.microsoft.com\] to obtain these libraries.

When you want to find information about Web Services in the UDDI registry, you first "find" the service, and then you "get" the details. After the Find stage, you typically know whether your search has been successful. Each message (e.g., Find_Business) returns a specific message type. You typically use the Find message if you're looking for someone that offers a certain Web service. You might use the Get message if you're familiar with a company's Web service but want to learn more about its implementation and related features.

According to the early UDDI SDK beta, which is available at the Microsoft Web site, to talk with UDDI, you need to construct a SOAP message, populate it with a Find_Business message, and then add search criteria to that message. Find_Business, which is just one of the several messages you can use, lets you search for the services that a particular company offers.

First, create the SOAP envelope object and the Find_Business object:

   Set env = New Envelope
   Set find_b = New find_business

Next, put the Find_Business object into the SOAP envelope:

Set env.Plugin = find_b

Specify the search criteria, and run the query:

find_b.Name = "My Company, Inc."

You can set other parameters to refine your search (e.g., whether to conduct a case-sensitive search or to search for an exact string of characters):

find_b.findQualifiers.AddfindQualifier caseSensitiveMatch
find_b.findQualifiers.AddfindQualifier exactNameMatch

You can also specify the maximum number of rows you want to receive:

find_b.maxRows = 50

Finally, you need to send the request. Set up the object that controls communications with a UDDI registry, and issue the query:

Set req = New UDDIEnv.RequestManager
Set env = req.UDDIRequest(env)

Notice that you can use the same envelope to send the request and receive the response. After the request completes, the UDDIErrNo data member tells you whether any errors occurred during the transmission. A value of 0 indicates that all went well.

When you send a Find_XXX envelope, you expect to receive an XXXList message—in this case, a BusinessList message—in response. To check the message type, compare the word "BusinessList" against the envelope object's MessageType property. If true, allocate an object to handle the freshly obtained BusinessList, and attach that object to the envelope:

Set bizlist = New businessList
Set env.Plugin = bizlist

Now you're ready to drill down into the body of the response. First, check the matches found, if any, by reviewing the bizlist.Count property. To analyze the results, use the XXXinfo object:

Dim info As businessInfo
For Each info In bizlist.businessInfos

Next

You use similar syntax to update data on the UDDI registry, but instead of Find methods, you use Save methods. You use Save_Business to save a new business registration or modify an existing registration. Again, use the businessInfo data structure to manage information.

For Web Services, UDDI is certainly not the only specification you must know to publish data—Web Services Description Language (WSDL) scripts and .disco files also play a significant role. WSDL, .disco sources, and UDDI can all you meet your expectations for publishing and advertising Web Services.