Share via


FindBusiness Constructor ()

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
Initializes an instance of the FindBusiness class.

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

Usage

Visual Basic
  Dim instance As New FindBusiness

Syntax

'Declaration
PublicSubNew
publicFindBusiness ()
public:
FindBusiness ()
publicFindBusiness ()
publicfunctionFindBusiness ()

Example

The following example shows you how to use the C# programming language together with this class to find a business that uses the specified UddiConnection and Name objects.

public void FindBusinessSample(Microsoft.Uddi.UddiConnection myConn,
                               Microsoft.Uddi.Name businessName)
{
    try
    {
        // Create a NameCollection object with the business name.
        // Set the Names property of the FindBusiness object to the 
        // NameCollection object.
        Microsoft.Uddi.FindBusiness findBiz = new FindBusiness();
        Microsoft.Uddi.NameCollection bizNames = new NameCollection(businessName);
        findBiz.Names = bizNames;
        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.Text));
                break;
            }

            default:
            {
                Console.WriteLine(String.Concat("There are ",
                                                 bizCount, 
                                                 " businesses called ", 
                                                 businessName.Text,
                                                 "."));
                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 that uses the specified UddiConnection and Name objects.

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

    Dim findBiz As Microsoft.Uddi.FindBusiness
    Dim bizNames As Microsoft.Uddi.NameCollection
    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

        ' Create a NameCollection object with the business name.
        ' Set the Names property of the FindBusiness object to the 
        ' NameCollection object.
        bizNames = New Microsoft.Uddi.NameCollection(businessName)
        findBiz.Names = bizNames
        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.Text))

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

        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

The default constructor initializes any fields to their default values.

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 Class
FindBusiness Members
Microsoft.Uddi Namespace