FindBusiness Class

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
Represents a request to locate businesses that meet specific requirements.

Namespace: Microsoft.Uddi
Assembly: microsoft.uddi (in microsoft.uddi.dll)

Usage

Visual Basic
  Dim instance As FindBusiness

Syntax

'Declaration
<XmlRootAttribute("find_business", Namespace:="urn:uddi-org:api_v2")> _
PublicClassFindBusinessImplementsICloneable
[XmlRootAttribute("find_business", Namespace="urn:uddi-org:api_v2")] 
publicclassFindBusiness : ICloneable
[XmlRootAttribute(L"find_business", Namespace=L"urn:uddi-org:api_v2")] 
publicref classFindBusiness : ICloneable
/** @attribute XmlRootAttribute("find_business", Namespace="urn:uddi-org:api_v2") */ 
publicclassFindBusinessimplementsICloneable
XmlRootAttribute("find_business", Namespace="urn:uddi-org:api_v2") 
publicclassFindBusinessimplementsICloneable

Example

The following example shows you how to use the Visual C# programming language with this class to find a business using a business name and a specified UddiConnection object.

public void FindBusinessSample(Microsoft.Uddi.UddiConnection myConn,
                               string businessName)
{
    try
    {
        Microsoft.Uddi.FindBusiness findBiz = new FindBusiness(businessName);
        BusinessList bizList = findBiz.Send(myConn);

        // Display the results of the search. 
        int bizCount = bizList.BusinessInfos.Count;

        switch(bizCount)
        {
            case(0):
            {
                Console.WriteLine("No results from the search.");
                return;
            }

            case(1):
            {
                Console.WriteLine(String.Concat("There is one business called ", 
                                                 businessName,
                                                 "."));
                break;
            }

            default:
            {
                Console.WriteLine(String.Concat("There are ",
                                                 bizCount, 
                                                 " businesses called ", 
                                                 businessName,
                                                 "."));
                break;
            }
        }

        // Show each business name.
        foreach(BusinessInfo bizInfo in bizList.BusinessInfos)
        {
            foreach(Name bizName in bizInfo.Names)
            {
                Console.WriteLine(bizName.Text);
            }
        }
    }

    catch (UddiException uddiEx)
    {
        Console.WriteLine(String.Concat("UDDI error: ", uddiEx.Message));
    }

    catch (Exception genEx)
    {
        Console.WriteLine(String.Concat("General exception: ", genEx.Message));
    }
}

The following example shows you how to use the Visual Basic .NET programming language together with this class to find a business by using a business name and a specified UddiConnection object.

Public Sub FindBusinessSample(ByVal myConn As Microsoft.Uddi.UddiConnection, _
                              ByVal businessName As String)

    Dim findBiz As Microsoft.Uddi.FindBusiness
    Dim bizList As Microsoft.Uddi.BusinessList
    Dim bizCount As Integer
    Dim bizInfo As Microsoft.Uddi.Businesses.BusinessInfo
    Dim bizName As Microsoft.Uddi.Name

    Try
        findBiz = New Microsoft.Uddi.FindBusiness(businessName)
        bizList = findBiz.Send(myConn)

        ' Display the results of the search.
        bizCount = bizList.BusinessInfos.Count

        Select Case bizCount

            Case 0
                Console.WriteLine("No results from the search.")

            Case 1
                Console.WriteLine(String.Concat("There is one business called ", _
                                                businessName))

            Case Else
                Console.WriteLine(String.Concat("There are ", _
                                                bizCount, _
                                                " businesses called ", _
                                                businessName, _
                                                "."))

        End Select

        ' Show each business name.
        For Each bizInfo In bizList.BusinessInfos
            For Each bizName In bizInfo.Names
                Console.WriteLine(bizName.Text)
            Next
        Next

        Catch uddiEx As Microsoft.Uddi.UddiException
            Console.WriteLine(String.Concat("UDDI error: ", uddiEx.Message))

        Catch ex As Exception
            Console.WriteLine(ex.GetType())

    End Try

End Sub

Remarks

When the Send method is called, the FindBusiness class returns a BusinessList object. This object contains a list of businesses that matched the search criteria set by the FindBusiness properties at the time the Send method was called.

Inheritance Hierarchy

System.Object
  Microsoft.Uddi.FindBusiness

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Target Platforms

Windows Server 2008, Windows Server 2003, Windows XP Professional, Windows Vista, Windows Server 2003 R2, Windows XP

See Also

Reference

FindBusiness Members
Microsoft.Uddi Namespace

Other Resources

Finding a Business