Pessoal,
Estou com um problema quando preciso acessar o WS da Sefaz e minha rede funciona com Proxy.
Quando desativamos o Proxy funciona normal.
Em Java já tenho isso resolvido, só que estamos mexendo com C#. Como devo proceder?
O método que faz a chamada.
private void consultarDfe(String nomeCertificadoRecebido, XmlReader x)
{
try
{
String numeroSerieCertificado = ajustarCertificado(nomeCertificadoRecebido);
XElement xml = XElement.Load(x);
Console.WriteLine(xml.ToString());
EndpointAddress epa = new EndpointAddress("https://www1.nfe.fazenda.gov.br/NFeDistribuicaoDFe/NFeDistribuicaoDFe.asmx");
ServiceReferenceNfeDistribuicao.NFeDistribuicaoDFeSoapClient nFeDistribuicaoDFeSoapClient = new ServiceReferenceNfeDistribuicao.NFeDistribuicaoDFeSoapClient();
nFeDistribuicaoDFeSoapClient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.My, X509FindType.FindBySerialNumber, numeroSerieCertificado);
System.Xml.Linq.XElement retorno = nFeDistribuicaoDFeSoapClient.nfeDistDFeInteresse(xml);
gravarRetorno("DFe_Util_Ret", retorno.ToString(), "OK");
}
catch (Exception e)
{
String erro = "ERRO\r\n" + e.ToString();
gravarRetorno("DFe_Util_Ret", null, erro);
gravarLog(e.Message);
}
}