Estou tentando enviar/gerar NFSe via Web Service para implantação ao meu sistema Para a Cidade de Costa Rica - MS
Sempre recebo a Mensagem:
<ns2:Mensagem>Arquivo enviado com erro na assinatura.</ns2:Mensagem>
<ns2:Correcao>Acerte a assinatura do arquivo.</ns2:Correcao>
já retirei os Caracteres especiais, porem não resolve.
segue em anexo o soap enviado e o retorno;
Fasso a Validação do XML no site da Receita e está Tudo Certo;
https://www.receita.fazenda.gov.br/Aplicacoes/SSL/ATBHE/assinadoc/ValidadorAssinaturas.app/valida.aspx
Imagino que a forma de aasinar pode estar errada.
Você pode me ajudar, com relação a assinatura do Lote?
estou usando c#:
public static string AssinaNFSe(string strXML, string strTag, string strURI, X509Certificate2 x509cert)
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.PreserveWhitespace = false;
xmlDoc.LoadXml(strXML);
// Create a SignedXml object.
SignedXml signedXml = new SignedXml(xmlDoc);
Reference reference = new Reference();
reference.Uri = strURI;
// Add the key to the SignedXml document
signedXml.SigningKey = x509cert.PrivateKey;
// Add an enveloped transformation to the reference.
XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform();
reference.AddTransform(env);
XmlDsigC14NTransform c14 = new XmlDsigC14NTransform();
reference.AddTransform(c14);
// Add the reference to the SignedXml object.
signedXml.AddReference(reference);
// Create a new KeyInfo object
KeyInfo keyInfo = new KeyInfo();
// Load the certificate into a KeyInfoX509Data object
// and add it to the KeyInfo object.
keyInfo.AddClause(new KeyInfoX509Data(x509cert));
// Add the KeyInfo object to the SignedXml object.
signedXml.KeyInfo = keyInfo;
signedXml.ComputeSignature();
xmlDoc.GetElementsByTagName(strTag)[0].AppendChild(xmlDoc.ImportNode(signedXml.GetXml(), true));
return xmlDoc.OuterXml;
}
gerarNfse.xml
Retorno.xml
gerarNfse.xml
Retorno.xml