none
saving tmodel in uddi services using uddi sdk RRS feed

  • Question

  • I am having this problem while trying to access my uddi service on windows server 2003. I am getting the exception http status 401: unauthorized.
    I am providing the correct credentials as i am using the same credentials to access the uddi services through web UI and it is workinf fine but i cannot do it programatically. I came to know that i need to set the authentication mode myself programatically for the web proxy but that didnt help either. I am also posting my code to you. may be you can guide me somehow. I will be really thankful.


                Publish.AuthenticationMode= AuthenticationMode.UddiAuthentication;
              
                WebProxy myWebProxy = new WebProxy();
                CredentialCache myCache=new CredentialCache();
                myCache.Add("emicuddi", 80, "basic", new NetworkCredential("uddiuser", "********"));
                myWebProxy.Credentials = myCache.GetCredential("localhost", 80, "basic");
                Publish.Url = "
    http://emicuddi/uddi/edit";
                Publish.User = "uddiuser";
                Publish.Password = "*******";
     
            
                //Create tModel
                SaveTModel stm = new SaveTModel();
                stm.TModels.Add();
                stm.TModels[0].Name = "a test service";
                stm.TModels[0].Descriptions.Add("A test service", "en");
                stm.TModels[0].OverviewDoc.OverviewURL = "
    http://localhost:8080/service1/mex?wsdl";
                //The following line is necessary for proper categorization of your tModel
                stm.TModels[0].CategoryBag.Add
                ("uddi-org:types",
                "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)
                {
                  
                    Console.WriteLine(ue.Message);
                    Console.ReadLine();
                    return;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadLine();
                    return;
                }

               
                Console.WriteLine(sTModelKey);
                Console.ReadLine();

    Monday, November 27, 2006 1:55 PM