Beispiel #1
0
        public void PrintBusinessInfo(businessInfo bInfo)
        {
            if (bInfo.name != null)
            {
                foreach (name n in bInfo.name)
                {
                    Console.WriteLine("Name:        " + n.Value);
                }
            }

            if (bInfo.description != null)
            {
                foreach (description desc in bInfo.description)
                {
                    Console.WriteLine("Description: " + desc.Value);
                }
            }
            Console.WriteLine("Key:         " + bInfo.businessKey);

            if (bInfo.serviceInfos != null)
            {
                PrintServiceInfos(bInfo.serviceInfos);
            }

            Console.WriteLine();
        }
Beispiel #2
0
        public void PrintBusinessInfo(businessInfo bInfo)
        {
            if (bInfo.name != null)
            {
                foreach (name n in bInfo.name)
                    Console.WriteLine("Name:        " + n.Value);
            }

            if (bInfo.description != null)
            {
                foreach (description desc in bInfo.description)
                    Console.WriteLine("Description: " + desc.Value);
            }
            Console.WriteLine("Key:         " + bInfo.businessKey);

            if (bInfo.serviceInfos != null)
                PrintServiceInfos(bInfo.serviceInfos);

            Console.WriteLine();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            GetCredentials();

            string sampleBusinessName        = "My WCF Sample Business";
            string sampleBusinessDescription = "My Sample Business published using WCF";

            UddiClient client = new UddiClient();

            try
            {
                Console.WriteLine("Logging in as user " + username + "...");
                client.Login(username, password);

                Console.WriteLine("Publish " + sampleBusinessName + "...");
                //Check if "My Business" was already published by me and delete it...
                businessInfo bInfo = client.GetMyBusinessByName(sampleBusinessName);
                if (bInfo != null)
                {
                    client.DeleteMyBusiness(bInfo.businessKey);
                }
                //Publish My Business
                string businessKey = "";

                businessKey = client.PublishBusiness(sampleBusinessName, sampleBusinessDescription);

                businessInfo[] bInfos = null;

                Console.WriteLine("Query for all businesses published by me....");
                bInfos = client.GetMyBusinesses();
                if (bInfos != null)
                {
                    Console.WriteLine("The following businesses are published by me:");
                    foreach (businessInfo info in bInfos)
                    {
                        client.PrintBusinessInfo(info);
                    }
                }

                Console.WriteLine("Query businesses by name '" + sampleBusinessName + "' in the registry...");
                bInfos = client.GetBusinessByName(sampleBusinessName);
                if (bInfos != null)
                {
                    Console.WriteLine("The following businesses are published under the name '" + sampleBusinessName + "':\n");
                    foreach (businessInfo info in bInfos)
                    {
                        client.PrintBusinessInfo(info);
                    }
                }

                if (businessKey != string.Empty)
                {
                    Console.WriteLine("Deleting business \"" + sampleBusinessName + "\" created earlier");
                    client.DeleteMyBusiness(businessKey);
                }
            }
            catch (FaultException fault)
            {
                string faultReason = fault.Reason.Translations[0].Text;
                Console.WriteLine("Received Fault: " + faultReason);
                if (faultReason.Contains("Publisher limit") == true)
                {
                    Console.WriteLine("You have a limited number of businesses you can publish.\n" +
                                      "Use GetMyBusinesses() to query your published businesses \n" +
                                      " and DeleteMyBusiness(businessKey) to delete them.");
                }
                Console.WriteLine();
            }

            //Closing the clients gracefully closes the connection and cleans up resources
            client.Close();

            Console.WriteLine("Press <ENTER> to exit.");
            Console.ReadLine();
        }