/// <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); } } }
/// <summary> /// Adds the provider. /// </summary> /// <param name="pName">Name of the provider.</param> /// <param name="pDescription">The provider description.</param> public void AddProvider(string pName, string pDescription) { try { UDDIPublisher.SaveBusinessEntity(UDDIConnection, UDDIDataCreater.CreateBusinessEntity(pName, pDescription)); } catch (Exception ex) { throw new Exception("Unable to add the provider " + ex.Message); } }
/// <summary> /// Updates the service name and descriotion. /// </summary> /// <param name="sName">Name of the service.</param> /// <param name="newSName">New name of the service.</param> /// <param name="newSDescription">The new service description.</param> public void UpdateService(string sName, string newSName, string newSDescription) { BusinessService bService = UDDISearcher.GetService(UDDIConnection, sName); if (null != bService) { bService.Names.Clear(); bService.Descriptions.Clear(); bService.Names.Add(new Name(newSName)); bService.Descriptions.Add(new Description(newSDescription)); UDDIPublisher.SaveBusinessService(UDDIConnection, bService); } }
/// <summary> /// Deletes the business all services. /// </summary> /// <param name="pName">Name of the provider</param> public void DeleteBusinessAllServices(string pName) { try { if (UDDISearcher.IsServiceExists(UDDIConnection, pName)) { UDDIPublisher.DeleteBusinessAllServices(UDDIConnection, pName); } } catch (Exception ex) { throw new Exception("Unable to delete the services " + ex.Message); } }
/// <summary> /// Deletes the business service. /// </summary> /// <param name="sName">Name of the service.</param> public void DeleteBusinessService(string sName) { try { string sKey = UDDISearcher.GetServiceKey(UDDIConnection, sName); if (!String.IsNullOrEmpty(sKey)) { UDDIPublisher.DeleteBusinessService(UDDIConnection, sKey); } } catch (Exception ex) { throw new Exception("Unable to delete the service " + ex.Message); } }
/// <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); } } }
/// <summary> /// Adds the T model. /// </summary> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="parent">The parent.</param> /// <param name="keyValue">The key value.</param> /// <param name="keyName">Name of the key.</param> public void AddTModel(string name, string description, string parent, string keyValue, string keyName) { TModel tm = UDDIDataCreater.CreateTModel(name, description); //search if tmodel has parent tmodel string parentKey = UDDISearcher.GetTModelKey(UDDIConnection, parent); if (parentKey != string.Empty) { //set the parent tmodel key of child tmodel KeyedReference kf = UDDIDataCreater.CreateKeyedReference(parentKey, keyValue, keyName); tm.CategoryBag.KeyedReferences.Add(kf); } try { UDDIPublisher.SaveTModel(UDDIConnection, tm); } catch (Exception exception) { throw new Exception("Unable to save the TModel " + exception.Message); } }
/// <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); } } } }