Esempio n. 1
0
 /// <summary>
 /// Adds the service.
 /// </summary>
 /// <param name="pName">Name of the provider.</param>
 /// <param name="sName">Name of the service.</param>
 /// <param name="sDescription">The service description.</param>
 /// <param name="aPoint">Access point of the service.</param>
 /// <param name="categoryName">Name of the category.</param>
 /// <param name="keyName">Name of the key.</param>
 /// <param name="keyValue">The key value.</param>
 public void AddService(string pName, string sName, string sDescription, string aPoint, string categoryName, string keyName, string keyValue)
 {
     if (UDDISearcher.GetServiceKey(UDDIConnection, sName).Equals(String.Empty))
     {
         BusinessService bService = UDDIDataCreater.CreateBusinessService(sName, sDescription);
         string          bKey     = UDDISearcher.GetBusinessKey(UDDIConnection, pName);
         bService.BusinessKey = bKey;
         bService.BindingTemplates.Add(UDDIDataCreater.CreateBindingTemplate(UDDIDataCreater.CreateAccessPoint(aPoint)));
         bService.CategoryBag.KeyedReferences.Add(UDDIDataCreater.CreateKeyedReference(UDDISearcher.GetTModelKey(UDDIConnection, categoryName), keyValue, keyName));
         try
         {
             UDDIPublisher.SaveBusinessService(UDDIConnection, bService);
         }
         catch (Exception ex)
         {
             throw new Exception("Unable to add the service " + ex.Message);
         }
     }
     else
     {
         BusinessService bService = UDDISearcher.GetService(UDDIConnection, sName);
         bService.BindingTemplates.Add(UDDIDataCreater.CreateBindingTemplate(UDDIDataCreater.CreateAccessPoint(aPoint)));
         bService.CategoryBag.KeyedReferences.Add(UDDIDataCreater.CreateKeyedReference(UDDISearcher.GetTModelKey(UDDIConnection, categoryName), keyValue, keyName));
         try
         {
             UDDIPublisher.SaveBusinessService(UDDIConnection, bService);
         }
         catch (Exception ex)
         {
             throw new Exception("Unable to add the service " + ex.Message);
         }
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Deletes the business's all services.
        /// </summary>
        /// <param name="uConn">The UDDI connection.</param>
        /// <param name="pName">Name of the provider</param>
        public static void DeleteBusinessAllServices(UddiConnection uConn, string pName)
        {
            BusinessEntity businessEntity = UDDISearcher.GetBusinessEntity(uConn, UDDISearcher.GetBusinessKey(uConn, pName));

            foreach (BusinessService businessService in businessEntity.BusinessServices)
            {
                DeleteService dService = new DeleteService(businessService.ServiceKey);
                dService.Send(uConn);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the contact.
        /// </summary>
        /// <param name="pName">Name of the provider.</param>
        /// <param name="cName">Name of the contact.</param>
        /// <param name="cDescription">The contact description.</param>
        /// <param name="cEMail">The contact E mail.</param>
        /// <param name="cPhone">The contact phone.</param>
        /// <param name="cAddress">The contact address.</param>
        public void AddContact(string pName, string cName, string cDescription, string cEMail, string cPhone, string cAddress)
        {
            string pKey = UDDISearcher.GetBusinessKey(UDDIConnection, pName);

            if (!String.IsNullOrEmpty(pKey))
            {
                BusinessEntity bEntity = UDDISearcher.GetBusinessEntity(UDDIConnection, pKey);
                bEntity.Contacts.Add(UDDIDataCreater.CreateContact(cName, cDescription, cEMail, cPhone, cAddress));
                try
                {
                    UDDIPublisher.SaveBusinessEntity(UDDIConnection, bEntity);
                }
                catch (Exception ex)
                {
                    throw new Exception("Unable to add the contact " + ex.Message);
                }
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Adds the service to the provider.
        /// </summary>
        /// <param name="pName">Name of the provider.</param>
        /// <param name="aPoint">Access point.</param>
        /// <param name="categoryNameList">The category list for the service.</param>
        public void AddService(string pName, string aPoint, List <CategoryObject> categoryNameList)
        {
            //if service not exists
            if (UDDISearcher.GetServiceKey(UDDIConnection, categoryNameList[0].cName + " Service").Equals(String.Empty))
            {
                //create service
                BusinessService bService = UDDIDataCreater.CreateBusinessService(categoryNameList[0].cName + " Service", "Service description for " + categoryNameList[0].cName + " Service");
                string          bKey     = UDDISearcher.GetBusinessKey(UDDIConnection, pName);
                bService.BusinessKey = bKey;
                //create binding template of the service
                bService.BindingTemplates.Add(UDDIDataCreater.CreateBindingTemplate(UDDIDataCreater.CreateAccessPoint(aPoint)));

                KeyedReference kReference;
                for (int i = 0; i < categoryNameList.Count; i++)
                {
                    kReference = UDDIDataCreater.CreateKeyedReference(UDDISearcher.GetTModelKey(UDDIConnection, categoryNameList[i].tModelName), UDDISearcher.GetCategory(UDDIConnection, categoryNameList[i].tModelName, categoryNameList[i].cName), categoryNameList[i].cName);
                    //add category to the service if not exits
                    if (!bService.CategoryBag.KeyedReferences.Contains(kReference))
                    {
                        bService.CategoryBag.KeyedReferences.Add(kReference);
                    }
                    //add category to the binding template if not exits
                    if (/*i > 0 && */ !bService.BindingTemplates[bService.BindingTemplates.Count - 1].CategoryBag.KeyedReferences.Contains(kReference))
                    {
                        bService.BindingTemplates[bService.BindingTemplates.Count - 1].CategoryBag.KeyedReferences.Add(kReference);
                    }
                }
                try
                {
                    UDDIPublisher.SaveBusinessService(UDDIConnection, bService);
                }
                catch (Exception ex)
                {
                    throw new Exception("Unable to add the service " + ex.Message);
                }
            }
            else
            {
                //find the service
                BusinessService bService = UDDISearcher.GetService(UDDIConnection, categoryNameList[0].cName + " Service");

                BindingTemplate bTemplate = UDDIDataCreater.CreateBindingTemplate(UDDIDataCreater.CreateAccessPoint(aPoint));
                //check if the binding already exists
                if (!bService.BindingTemplates.Contains(bTemplate, new BindigTemplateComparer()))
                {
                    //add binding template to the service
                    bService.BindingTemplates.Add(bTemplate);
                    KeyedReference kReference;
                    for (int i = 0; i < categoryNameList.Count; i++)
                    {
                        kReference = UDDIDataCreater.CreateKeyedReference(UDDISearcher.GetTModelKey(UDDIConnection, categoryNameList[i].tModelName), UDDISearcher.GetCategory(UDDIConnection, categoryNameList[i].tModelName, categoryNameList[i].cName), categoryNameList[i].cName);
                        //add category to the service if not exits
                        if (!bService.CategoryBag.KeyedReferences.Contains(kReference))
                        {
                            bService.CategoryBag.KeyedReferences.Add(kReference);
                        }
                        //add category to the binding template if not exits
                        if (/*i > 0 &&*/ !bService.BindingTemplates[bService.BindingTemplates.Count - 1].CategoryBag.KeyedReferences.Contains(kReference))
                        {
                            bService.BindingTemplates[bService.BindingTemplates.Count - 1].CategoryBag.KeyedReferences.Add(kReference);
                        }
                    }
                    try
                    {
                        UDDIPublisher.SaveBusinessService(UDDIConnection, bService);
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("Unable to update the service " + ex.Message);
                    }
                }
            }
        }