I'm getting the following error when trying to consume the GO NFe WebService
Error 90 - NfeStatusServico. The remote server returned an unexpected response: (495) Unknown Code
As I'm creating a dll I do not have the configuration file
private System.ServiceModel.Channels.CustomBinding getBinding
{
get
{
System.ServiceModel.Channels.HttpsTransportBindingElement objHttpsTransportBindingElement = new HttpsTransportBindingElement();
objHttpsTransportBindingElement.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
objHttpsTransportBindingElement.ManualAddressing = false;
objHttpsTransportBindingElement.MaxBufferPoolSize = 524288;
objHttpsTransportBindingElement.MaxReceivedMessageSize = 65536;
objHttpsTransportBindingElement.AllowCookies = false;
objHttpsTransportBindingElement.BypassProxyOnLocal = false;
objHttpsTransportBindingElement.KeepAliveEnabled = true;
objHttpsTransportBindingElement.MaxBufferSize = 65536;
objHttpsTransportBindingElement.Realm = string.Empty;
objHttpsTransportBindingElement.TransferMode = TransferMode.Buffered;
objHttpsTransportBindingElement.AuthenticationScheme = System.Net.AuthenticationSchemes.Digest;
objHttpsTransportBindingElement.UnsafeConnectionNtlmAuthentication = false;
objHttpsTransportBindingElement.UseDefaultWebProxy = true;
objHttpsTransportBindingElement.RequireClientCertificate = true;
TextMessageEncodingBindingElement objTextMessageEncodingBindingElement = new TextMessageEncodingBindingElement();
objTextMessageEncodingBindingElement.MessageVersion = MessageVersion.Soap12;
objTextMessageEncodingBindingElement.WriteEncoding = Encoding.UTF8;
objTextMessageEncodingBindingElement.MaxReadPoolSize = 64;
objTextMessageEncodingBindingElement.MaxWritePoolSize = 16;
System.ServiceModel.Channels.CustomBinding objCustomBinding = new System.ServiceModel.Channels.CustomBinding(objTextMessageEncodingBindingElement, objHttpsTransportBindingElement);
return objCustomBinding;
}
}
public void NfeStatusServico(string cUF, string tpAmb, string noSerieCert, string hostWS, string pUF, bool trace)
{
Certificado cert = new Certificado();
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(hostWS);
NFeStatusServico4.NFeStatusServico4ServiceClient cliente = new NFeStatusServico4.NFeStatusServico4ServiceClient(getBindingGO, address);
cliente.Endpoint.Address = address;
cliente.ClientCredentials.ServiceCertificate.DefaultCertificate = cert.BuscaNroSerie(noSerieCert, false);
cliente.ClientCredentials.ClientCertificate.Certificate = cert.BuscaNroSerie(noSerieCert, false);
string corpoMsg = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<consStatServ xmlns=\"http://www.portalfiscal.inf.br/nfe\" versao=\"" + Le_Config("NFE", "verProc").ToString() + "\">" +
"<tpAmb>" + tpAmb + "</tpAmb>" +
"<cUF>" + cUF + "</cUF>" +
"<xServ>STATUS</xServ>" +
"</consStatServ>";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(corpoMsg);
if (trace)
MessageBox.Show(xmlDoc.DocumentElement.InnerXml, "Envio de Msg - NfeStatusServico4");
XmlNode retNode = cliente.nfeStatusServicoNF(xmlDoc.DocumentElement);
}
This method is working for other states only for CE and GO
What do I have to do to work for CE and GO
Thank you