Share via


Using the Microsoft UDDI SDK-Error Handling

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

This section contains information about handling errors that can occur when accessing a UDDI server.

When accessing a UDDI server there several types of errors that can occur. They fall into the following three categories:

  • A specific error that occurs while the UDDI server is processing an API call

  • A generic error that occurs within the SDK during the construction, sending, or interpretation of an API message

  • A client system error that occurs that is not specific to UDDI

Example Code

The following example demonstrates how to use the C# programming language with structured exception handling to manage errors that can occur when accessing a UDDI server.

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("Fabrikam");

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

    // Report the summary result.
    Console.WriteLine("Businesses found=" + bizList.BusinessInfos.Count.ToString());
}
catch( Microsoft.Uddi.BusyException busyE)
{
    // Handle the E_busy exception.
    Console.WriteLine("The UDDI server was busy: " + busyE.Message);
}
catch( Microsoft.Uddi.FatalErrorException fatalE )
{
    // Handle the E_fatalError exception.
    Console.WriteLine("The UDDI server experienced a fatal error: " + fatalE.Message);
}
catch( Microsoft.Uddi.UddiException uddiE )
{
    // Catch the general UDDI exception and examine the type.
    if (typeof(Microsoft.Uddi.InvalidCategoryException) == uddiE.GetType())
    {
        Console.WriteLine("Please check the categorizations in use.");
    }
    else
    {
        // Return the type of error and the server generated error text.
        Console.WriteLine("UDDI error: {0} : {1}",
                        uddiE.GetType().ToString(),
                        uddiE.Message);
    }
}
catch(Exception gen)
{
    // Any other exception
    Console.WriteLine("General exception: {0}", gen.Message);
}

Send comments about this topic to Microsoft.