Getting Detailed Business Information

Note: The Microsoft UDDI SDK is not supported by or included in Microsoft Windows versions after Microsoft Windows Server 7. The Microsoft UDDI V3 SDK is included with Microsoft BizTalk Server. For more information about the Microsoft UDDI V3 SDK, see Microsoft BizTalk Server documentation

UDDI registries can display both basic and detailed information about a business. To get detailed information about a business, use the GetBusinessDetail class, as shown in the following example.

Example Code

The following example shows you how to use the C# programming language to find detailed information about a business. In this case, the example finds detailed information about businesses with names that begin with the word "Fabrikam".

using System;

using Microsoft.Uddi;
using Microsoft.Uddi.Businesses;
using Microsoft.Uddi.Services;

public class GetMyBizDetails
{

    public static void Main(string [] args)
    {
        string bName = "Fabrikam";
        int i = 1;

        try 
        {
            // Create a connection to the UDDI server that is to be accessed. Replace the contoso.com placeholder URL with your own UDDI server.
            UddiConnection myConn = new UddiConnection("http://test.uddi.contoso.com/inquire");

            // Create an object to find a business.
            FindBusiness fb = new FindBusiness(bName);

            // Send the FindBusiness request over the connection.
            BusinessList bizList = fb.Send(myConn);

            // Report the results.
            foreach (BusinessInfo bizInfo in bizList.BusinessInfos)
            {
                // Display info about which business.
                Console.WriteLine("Getting information about " + bName + "(" + i + "):");
                i++;

                // Provide the unique business key from the call to FindBusiness.
                GetBusinessDetail gb = new GetBusinessDetail(bizInfo.BusinessKey);

                // Send the GetBusinessDetail request over the connection.
                BusinessDetail bizDetail = gb.Send(myConn);

                // Only a single key was provided so a single set of business details should be returned.
                foreach (BusinessEntity bizEntity in bizDetail.BusinessEntities)
                {
                    // Display the category names, values, and tModel keys.    
                    foreach (KeyedReference catEntry in bizEntity.CategoryBag)
                    {
                        Console.WriteLine("Categories: name: {0}, value: {1}, tModelKey: {2}", 
                            catEntry.KeyName, catEntry.KeyValue, catEntry.TModelKey);
                    }

                    // Display the identifier names, values, and tModel keys.
                    foreach (KeyedReference identEntry in bizEntity.IdentifierBag)
                    {
                        Console.WriteLine("Identifiers: name: {0}, value: {1}, tModelKey: {2}", 
                            identEntry.KeyName, identEntry.KeyValue, identEntry.TModelKey);
                    }

                    // Display the contact names.
                    foreach (Contact bizCont in bizEntity.Contacts)    
                    {
                        Console.WriteLine("Contacts: name: " + bizCont.PersonName);
                    }

                    // Display the service names.
                    foreach (BusinessService bizServ in bizEntity.BusinessServices)
                    {
                        Console.WriteLine("Services: name: " + bizServ.Names[0].Text);

                        // Display the access points for the service.
                        foreach (BindingTemplate bindingT in bizServ.BindingTemplates)
                        {
                            Console.WriteLine("  Access point = " + bindingT.AccessPoint.Text);
                        }
                    }
                }
            }
        }
        catch (Microsoft.Uddi.UddiException e)
        {
            Console.WriteLine("UDDI error: " + e.Message);
        }
        catch (Exception gen)
        {
            Console.WriteLine("General exception: {0}", gen.Message);
        }
    }
}
// Use the following commands to compile and run this example after replacing
// "C:\MyUddiAssemblyDirectory\" with the full path to the Microsoft.Uddi assembly.
// To compile: csc.exe /r:C:\MyUddiAssemblyDirectory\microsoft.uddi.dll /out:GetMyBizDetails.exe GetMyBizDetails.cs
// To run:     GetMyBizDetails.exe

Send comments about this topic to Microsoft.