Problem with proxy and webservice C #

0

Error: Request failed with HTTP status 407: Proxy Authentication Required.

Hello everyone! I made the generation of a C # class using the xsd file using the VS Developer Command I added it in my project.

In my project, I am filling in the necessary information and generating a file like the integration manual, I am having a problem sending.

  public ActionResult Index()
        {
            string CaminhoWebServiceHomologacao = ConfigurationManager.AppSettings["CaminhoWebServiceHomologacao"];
            Resolverproxy(CaminhoWebServiceHomologacao);


            //solicita login na homologação
            HomologacaoTJSP.ServicoPJ objWS = new HomologacaoTJSP.ServicoPJ();
            string Tabela = objWS.solicitaLogon(SolicitaLogin());

            return View();
        }

        public string Resolverproxy(string UrlWeb)
        {
            // Garantir que as configurações de segurança de diretório para o site padrão no IIS sejam "Autenticação do Windows". 
            string url = UrlWeb;
            // Cria um objeto 'HttpWebRequest' com o URL especificado.
            HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
            // Atribua as credenciais do usuário conectado ou do usuário sendo representado.
            myHttpWebRequest.Credentials = CredentialCache.DefaultCredentials;
            // Envie o 'HttpWebRequest' e aguarde a resposta.                  
            HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
            Console.WriteLine("Authentication successful");
            Console.WriteLine("Response received successfully");

            return myHttpWebResponse.ToString();
        }
    
asked by anonymous 14.06.2018 / 16:54

0 answers