Ejemplo n.º 1
0
        /// <summary>
        ///		Saves a new BusinessEntity object with the specified name and
        ///		description.
        /// </summary>
        /// <param name="name">Name for the new BusinessEntity.</param>
        /// <param name="desc">Description for the new BusinessEntity.</param>
        /// <returns>The Resulting BusinessEntity after saving it.</returns>
        private static BusinessEntity SaveNewProvider(string name, string desc)
        {
            BusinessEntity entity = new BusinessEntity();

            entity.Names.Add(name);
            entity.Descriptions.Add(desc);

            SaveBusiness   sb     = new SaveBusiness(entity);
            BusinessDetail detail = sb.Send(_connection);

            return(detail.BusinessEntities[0]);
        }
Ejemplo n.º 2
0
        public BusinessDetail Send(SaveBusiness saveBusiness, AuthToken authToken)
        {
            SetAuthToken(saveBusiness, authToken);

            try
            {
                return(soapClient.SaveBusiness(saveBusiness));
            }
            catch (UddiException uddiException)
            {
                AttemptRefreshAuthInfo(uddiException, authToken);

                return(soapClient.SaveBusiness(saveBusiness));
            }
        }
Ejemplo n.º 3
0
        public BusinessDetail SaveBusiness(SaveBusiness sb)
        {
            Debug.Enter();
            BusinessDetail bd = new BusinessDetail();

            try
            {
                sb.Save();
                bd.BusinessEntities = sb.BusinessEntities;
            }
            catch (Exception e)
            {
                DispositionReport.Throw(e);
            }

            return(bd);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///   Publica serviciul cu informatiile specificate in campurile corespunzatoare (daca nu exista deja).
        /// </summary>
        public void performPublish()
        {
            String businessName = txbBusinessName.Text.Trim();
            String serviceName  = txbServiceName.Text.Trim();
            String accessPoint  = txbAccessPoint.Text.Trim();

            if (businessName == String.Empty || serviceName == String.Empty || accessPoint == String.Empty) {

                MessageBox.Show("All values must be set", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try {

                FindBusiness findBusiness = new FindBusiness(businessName);

                findBusiness.FindQualifiers.Add(FindQualifier.ExactNameMatch);

                BusinessList businessList = findBusiness.Send(uddiConnection);

                if (0 == businessList.BusinessInfos.Count) {

                    BusinessEntity newBusinessEntity   = new BusinessEntity(businessName);

                    BusinessService newBusinessService = new BusinessService(serviceName);

                    newBusinessEntity.BusinessServices.Add(newBusinessService);

                    BindingTemplate newBindingTemplate = new BindingTemplate();

                    newBindingTemplate.AccessPoint.Text    = accessPoint;
                    newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                    selectOntologyForNewBindingTemplate(newBindingTemplate);

                    newBusinessService.BindingTemplates.Add(newBindingTemplate);

                    SaveBusiness saveNewBusiness = new SaveBusiness(newBusinessEntity);

                    saveNewBusiness.Send(uddiConnection);
                }
                else {

                    MessageBox.Show("Business already exists");

                    GetBusinessDetail getBusinessDetail = new GetBusinessDetail(businessList.BusinessInfos[0].BusinessKey);

                    BusinessDetail businessDetail    = getBusinessDetail.Send(uddiConnection);

                    BusinessEntity oldBusinessEntity = businessDetail.BusinessEntities[0];

                    FindService findService = new FindService(serviceName);

                    findService.FindQualifiers.Add(FindQualifier.ExactNameMatch);

                    findService.BusinessKey = businessDetail.BusinessEntities[0].BusinessKey;

                    ServiceList serviceList = findService.Send(uddiConnection);

                    if (0 == serviceList.ServiceInfos.Count) {

                        BusinessService newBusinessService     = new BusinessService(serviceName);

                        oldBusinessEntity.BusinessServices.Add(newBusinessService);

                        BindingTemplate newBindingTemplate     = new BindingTemplate();

                        newBindingTemplate.AccessPoint.Text    = accessPoint;
                        newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                        selectOntologyForNewBindingTemplate(newBindingTemplate);

                        newBusinessService.BindingTemplates.Add(newBindingTemplate);

                        SaveBusiness saveOldBusiness = new SaveBusiness(oldBusinessEntity);

                        saveOldBusiness.Send(uddiConnection);
                    }
                    else {

                        MessageBox.Show("Service already exists");

                        GetServiceDetail getServiceDetail  = new GetServiceDetail(serviceList.ServiceInfos[0].ServiceKey);

                        ServiceDetail serviceDetail        = getServiceDetail.Send(uddiConnection);

                        BusinessService oldBusinessService = serviceDetail.BusinessServices[0];

                        foreach (BindingTemplate bindingTemplate in oldBusinessService.BindingTemplates) {

                            if (bindingTemplate.AccessPoint.Text == accessPoint) {

                                MessageBox.Show("Binding already exists");
                                return;
                            }
                        }

                        BindingTemplate newBindingTemplate     = new BindingTemplate();

                        newBindingTemplate.AccessPoint.Text    = accessPoint;
                        newBindingTemplate.AccessPoint.UrlType = UrlType.Http;

                        selectOntologyForNewBindingTemplate(newBindingTemplate);

                        oldBusinessService.BindingTemplates.Add(newBindingTemplate);

                        SaveService saveOldService = new SaveService(oldBusinessService);

                        saveOldService.Send(uddiConnection);
                    }
                }

                MessageBox.Show("Publish successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (UddiException e) {

                MessageBox.Show("Uddi error: "+ e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception e){

                MessageBox.Show("General exception: " + e.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 5
0
        public BusinessDetail SaveBusiness([XmlElement(Namespace = Microsoft.Uddi.VersionSupport.UddiVersionSupport.CurrentNamespace, IsNullable = false)] SaveBusiness saveBusiness)
        {
            object[] results = InvokeWebMethod("SaveBusiness", new object[] { saveBusiness });

            return((BusinessDetail)results[0]);
        }
Ejemplo n.º 6
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string wsdl = TextBox1.Text;
        string tmodelname = TextBox2.Text;
        string tmodeldesp = TextBox3.Text;
        string busi_name = TextBox4.Text;
        string busi_desp = TextBox5.Text;
        string service_name = TextBox6.Text;
        string service_desp = TextBox7.Text;
        if (wsdl != null && tmodelname != null && tmodeldesp != null && busi_name != null && busi_desp != null && service_name != null
             && service_desp != null)
        {
            /*ep.UseDefaultCredentials = true;
            ep.ebay_publishing();*/
            Publish.Url = "http://WIN-NSA2A8QGUJO/uddipublic/publish.asmx";
            Publish.User = "******";
            Publish.Password = "******";

            //Create tModel
            SaveTModel stm = new SaveTModel();

            stm.TModels.Add();
            stm.TModels[0].Name = tmodelname;
            stm.TModels[0].Descriptions.Add("en", tmodeldesp );
            stm.TModels[0].OverviewDoc.OverviewURL = wsdl;
            stm.TModels[0].CategoryBag.Add
            ("CS779",
            "wsdlSpec",
            "uuid:c1acf26d-9672-4404-9d70-39b756e62ab4");
            string sTModelKey = "";
            //Send to UDDI
            try
            {
                TModelDetail tmd = stm.Send();
                sTModelKey = tmd.TModels[0].TModelKey;
            }
            catch (UddiException ue)
            {
                MessageBox.Show(ue.Message);
                return;
            }

                //BusinessEntity et = new BusinessEntity();
            //Create Business
            SaveBusiness sb = new SaveBusiness();
            sb.BusinessEntities.Add();
            sb.BusinessEntities[0].Names.Add(busi_name);
            sb.BusinessEntities[0].Descriptions.Add("en", busi_desp);
            //sb.BusinessEntities[0].CategoryBag.Add("categorization", "CS779","uuid:"+sTModelKey);
            //Create BusinessService
            sb.BusinessEntities[0].BusinessServices.Add();
            sb.BusinessEntities[0].BusinessServices[0].Names.Add(service_name);
            sb.BusinessEntities[0].BusinessServices[0].Descriptions.Add("en", service_desp);
            //sb.BusinessEntities[0].BusinessServices[0].CategoryBag.Add("categorization","CS779","uuid:"+sTModelKey);

            //Create BindingTemplate
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates.Add();
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].
            Descriptions.Add("en", "Binding");
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].
            AccessPoint.Text = "Access Point";
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].
            AccessPoint.URLType = Microsoft.Uddi.Api.URLType.Http;

            //Create tModelInstanceInfo
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].
            TModelInstanceDetail.TModelInstanceInfos.Add();
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].
            TModelInstanceDetail.TModelInstanceInfos[0].Descriptions.
            Add("en", "Insert Description Here");
            //Use tModelKey string from above
            sb.BusinessEntities[0].BusinessServices[0].BindingTemplates[0].
            TModelInstanceDetail.TModelInstanceInfos[0].TModelKey = sTModelKey;
            //Send to UDDI
            try
            {
                BusinessDetail bd = sb.Send();

            }
            catch (UddiException ue)
            {
                MessageBox.Show(ue.Message);
                return;
            }
            TextBox1.Text = String.Empty;
            TextBox2.Text = String.Empty;
            TextBox3.Text = String.Empty;
            TextBox4.Text = String.Empty;
            TextBox5.Text = String.Empty;
            TextBox6.Text = String.Empty;
            TextBox7.Text = String.Empty;
            get_Services();
        }
        else
        {
            MessageBox.Show("Make sure fields are not empty");
        }
    }
Ejemplo n.º 7
0
        /// <summary>
        /// Saves the business entity.
        /// </summary>
        /// <param name="uConn">The UDDI connection.</param>
        /// <param name="bEntity">The business entity.</param>
        public static void SaveBusinessEntity(UddiConnection uConn, BusinessEntity bEntity)
        {
            SaveBusiness sBusiness = new SaveBusiness(bEntity);

            sBusiness.Send(uConn);
        }