FONTE NFE VB.NET
Tentei baixar de 4 micros diferentes e em todos eles o arquivo baixou corrompido...
O meu XML de cancelamento ficou assim:
<procCancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<cancNFe xmlns:xsi=[Ô]http://www.w3.org/2001/XMLSchema-instance[Ô] versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<infCanc Id=[Ô]ID35100906988100000154550010000001281187229872[Ô]>
<tpAmb>2</tpAmb>
<xServ>CANCELAR</xServ>
<chNFe>35100906988100000154550010000001281187229872</chNFe>
<nProt>135100026082158</nProt>
<xJust>MOTIVO DO CANCELAMENTO</xJust>
</infCanc>
<Signature xmlns=[Ô]http://www.w3.org/2000/09/xmldsig#[Ô]>
<SignedInfo>
<CanonicalizationMethod Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
<SignatureMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#rsa-sha1[Ô] />
<Reference URI=[Ô]#ID35100906988100000154550010000001281187229872[Ô]>
<Transforms>
<Transform Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#enveloped-signature[Ô] />
<Transform Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
</Transforms>
<DigestMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#sha1[Ô] />
<DigestValue>Lbmi5lu/5+6HRUtD6GeQNFbN3O0=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>CsSfIB2w1oTP5hcb4TYNWeqFwX8drhUm2TzrjKvx0JWo0WJM8CFk127LIDu6mpAxyo6NXBT7GFOHtbRSx8Ha/3VDiGa5LsZPyNp3lKlZj6b2oEdEfH+rGO6AfoArK6ybWVbS7A48y4UY5CNKwqU/nxxcJLf0z8Ina6yaDMQXe+E=</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIIGVzCCBT+gAwIBAgIITu8YS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YO3TYX3E6FmzgYJxDsmxr4DyV7qLnwg==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</cancNFe>
</procCancNFe>
Entretanto estou recebendo a seguinte resposta do WS.
<infCanc xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<tpAmb>2</tpAmb>
<verAplic>SP_NFE_PL_006e</verAplic>
<cStat>242</cStat>
<xMotivo>Rejeição: Cabeçalho - Falha no Schema XML</xMotivo>
<cUF>35</cUF>
</infCanc>
Citação::
Leandro,
O meu XML de cancelamento ficou assim:
<procCancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<cancNFe xmlns:xsi=[Ô]http://www.w3.org/2001/XMLSchema-instance[Ô] versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<infCanc Id=[Ô]ID35100906988100000154550010000001281187229872[Ô]>
<tpAmb>2</tpAmb>
<xServ>CANCELAR</xServ>
<chNFe>35100906988100000154550010000001281187229872</chNFe>
<nProt>135100026082158</nProt>
<xJust>MOTIVO DO CANCELAMENTO</xJust>
</infCanc>
<Signature xmlns=[Ô]http://www.w3.org/2000/09/xmldsig#[Ô]>
<SignedInfo>
<CanonicalizationMethod Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
<SignatureMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#rsa-sha1[Ô] />
<Reference URI=[Ô]#ID35100906988100000154550010000001281187229872[Ô]>
<Transforms>
<Transform Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#enveloped-signature[Ô] />
<Transform Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
</Transforms>
<DigestMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#sha1[Ô] />
<DigestValue>Lbmi5lu/5+6HRUtD6GeQNFbN3O0=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>CsSfIB2w1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mLUyk0kBW/R8b/bBjkpgvQA/teBa5EKys9sp26Zt07ef1J9uROZP8gna1en2uJmzYqr2N9S6TOBnsF2KiIExgjGETdxdwXNHc0i67uLXCzrfdRmihncXFoUbpbvp4QbYfFSGHICT0PPZ0TLS8Amjl7FkKP/i0OsR9QLt2kzUMxPFOE4dxtKdZsqlInyXjCsg/3PutldW66lxzRvWCoH+mSIxvMV32SPQry0+nwdhkYO3TYX3E6FmzgYJxDsmxr4DyV7qLnwg==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</cancNFe>
</procCancNFe>
Entretanto estou recebendo a seguinte resposta do WS.
<infCanc xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<tpAmb>2</tpAmb>
<verAplic>SP_NFE_PL_006e</verAplic>
<cStat>242</cStat>
<xMotivo>Rejeição: Cabeçalho - Falha no Schema XML</xMotivo>
<cUF>35</cUF>
</infCanc>
caro, RODRIGUESRM
nos aki nesse topicos ja falamos varias vezes e volto a dizer novamente
usem os validadores de XML eles ajudam bastante http://www.sefaz.rs.gov.br/NFE/NFE-VAL.aspx e um anexo que eu coloquei feito por mim que ajuda bastante!
bom primeiro nao e possivel vc enviar um xml para a Sefaz <procCancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]> </procCancNFe> tire as duas tags
segundo se vc coloca-se no validador vc veria que a assinatura e invalida e as tags nao sao autorizadas
ai esta sua soluçao, e so isso!
abç
Eu estava trabalhando sem essas tags antes e obtinha o mesmo resultado, mesmo sem elas...
Estou utilizando mecanismo de validação existente no código aqui disponibilizado...
meu código está assim:
Citação:
Dim WS As New C_WebService(UrlAcesso)
Dim oNFE As New NFe
Dim oXMLCancelamento As New XmlDocument
Dim oXMLCancelamentoAssinado As New XmlDocument
Dim oCertificado As New X509Certificate2
Dim strResultadoValidacao As String
Dim retConsulta As RetEnvio
[ô]Preparando Informações de Cancelamento
[ô]-------------------------------------------------------------------------------------------------------------------------
oNFE.versao = [Ô]2.00[Ô]
oNFE.Id = [Ô]35100906988100000154550010000001281187229872[Ô]
oNFE.nProt = [Ô]135100026082158[Ô]
oNFE.xJust = [Ô]MOTIVO DO CANCELAMENTO[Ô]
oNFE.infNFE.Ide.tpAmb = [Ô]2[Ô]
oXMLCancelamento = oNFE.GerarXMLCancelamento()
[ô]Assinando o XML de Cancelamento
[ô]Selecionando o Certificado
[ô]-------------------------------------------------------------------------------------------------------------------------
oCertificado = CertificadoDigital.SelecionarCertificado([Ô]4EEF184BB922FA30[Ô])
[ô]Assinando o XML
[ô]-------------------------------------------------------------------------------------------------------------------------
If Not oCertificado Is Nothing Then
oXMLCancelamentoAssinado = New XmlDocument
oXMLCancelamentoAssinado = CertificadoDigital.Assinar(oXMLCancelamento, [Ô]infCanc[Ô], oCertificado) [ô]Assinando o XML
End If
[ô]Validando o XML Assinado
[ô]-------------------------------------------------------------------------------------------------------------------------
strResultadoValidacao = ValidaXML.ValidarXML(oXMLCancelamentoAssinado, [Ô]cancNFe_v2.00.xsd[Ô])
If strResultadoValidacao.Trim().Length > 0 Then
MsgBox([Ô]Falha na validação do XML![Ô] & vbCrLf & strResultadoValidacao)
Exit Sub
End If
[ô]Gerando arquivo XML de cancelamento
[ô]-------------------------------------------------------------------------------------------------------------------------
[ô]Importante:
[ô]Salvar através do TextWriter evita que o XML saia formatado no arquivo, desta forma o mesmo
[ô]pode ser rejeitado por alguns estados e/ou não validar nos programas teste
Using xmltw As New XmlTextWriter([Ô]C:\cancelamento.xml[Ô], New UTF8Encoding(False))
oXMLCancelamentoAssinado.WriteTo(xmltw)
xmltw.Close()
End Using
[ô]---> QUANDO CHEGA AQUI O XML Gerado é o que consta abaixo (já validado e assinado)
[ô]Enviando XML de Cancelamento
[ô]-------------------------------------------------------------------------------------------------------------------------
WS.EnviaCancelamento([Ô]c:\cancelamento.xml[Ô])
abaixo o conteúdo da sub EnviaCancelamento
Citação:
Public Sub EnviaCancelamento(ByVal EndArquivoXml As String)
Dim strRetorno As XmlElement
Dim xmldoc = New XmlDocument()
Dim xmlRetorno As XmlNode
[ô]Carrega o arquivo XML
xmldoc.Load(EndArquivoXml)
Dim CERT As X509Certificate2
CERT = SelecionarCertificado([Ô]4EEF184BB922FA30[Ô])
Try
[ô]Dim wsMsg As Recepcao2.NfeRecepcao2
[ô]Dim cab As New Recepcao2.nfeCabecMsg
Dim wsMsg As NfeCancelamento2
[ô]UF E VERSÃO DO CABEÇALHO
[ô]cab.cUF = S_Url.CodigoUF
[ô]cab.versaoDados = VersaoAtualNfe
Dim Notas As String
[ô]CABEÇALHO USADA PARA ENVIO DE LOTE
[ô]wsMsg = New Recepcao2.NfeRecepcao2(S_Url.UrlNfeCancelamento)
wsMsg = New NfeCancelamento2(S_Url.UrlNfeCancelamento)
[ô]wsMsg.nfeCabecMsgValue = cab
wsMsg.Timeout = 100000
wsMsg.ClientCertificates.Add(CERT)
wsMsg.SoapVersion = SoapProtocolVersion.Soap12
Notas = xmldoc.OuterXml
[ô]RETORNO DA SEFAZ
[ô]strRetorno = wsMsg.nfeRecepcaoLote2(xmldoc)
xmlRetorno = wsMsg.nfeCancelamentoNF2(xmldoc)
xmldoc.LoadXml(xmlRetorno.InnerXml) [ô]---> Aqui eu já vejo o retorno com o XML de Falha no Schema de XML
[ô]... Codigo de tratamento de retorno ...
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, [Ô][Ô])
End Try
End Sub
Aqui está o XML que foi gerado (já validado e assinado).
Citação:
<cancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<infCanc Id=[Ô]ID35100906988100000154550010000001281187229872[Ô]>
<tpAmb>2</tpAmb>
<xServ>CANCELAR</xServ>
<chNFe>35100906988100000154550010000001281187229872</chNFe>
<nProt>135100026082158</nProt>
<xJust>MOTIVO DO CANCELAMENTO</xJust>
</infCanc>
<Signature xmlns=[Ô]http://www.w3.org/2000/09/xmldsig#[Ô]>
<SignedInfo>
<CanonicalizationMethod Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
<SignatureMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#rsa-sha1[Ô] />
<Reference URI=[Ô]#ID35100906988100000154550010000001281187229872[Ô]>
<Transforms>
<Transform Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#enveloped-signature[Ô] />
<Transform Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
</Transforms>
<DigestMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#sha1[Ô] />
<DigestValue>qdEV1VMBXQAj+hU9/uO460P2voI=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>BBFQeJ6oXlUI1ta2g7/QKNOWYIUk6WREOi6ArG712Yk29uA38gCzhScG1x3Sr/s3ZUqGIBmg/PplOUcDHb5IDi0VjcMg0Q0G1WmmWtRKHywI8wreGtpUdSk2vKZDuE27Oo4dsC+mav7Mkb8Z3uz1kUBJNo9m3oZ8Z/73cbSdq9o=</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIIGVzCCBT+gAwIBAgIITu8YS7ki+jAwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxKDAmBgNVBAMTH1NFUkFTQSBDZXJ0aWZpY2Fkb3JhIERpZ2l0YWwgdjEwHhcNMTAwMzExMTMyNTUxWhcNMTEwMzExMTMyNTUxWjCCAQoxCzAJBgNVBAYTAkJSMRMwEQYDVQQKEwpJQ1AtQnJhc2lsMRQwEgYDVQQLEwsoRU0gQlJBTkNPKTEYMBYGA1UECxMPMDAwMDAxMDAwOTA1MTAzMRQwEgYDVQQLEwsoRU0gQlJBTkNPKTEUMBIGA1UECxMLKEVNIEJSQU5DTykxFDASBgNVBAsTCyhFTSBCUkFOQ08pMRQwEgYDVQQLEwsoRU0gQlJBTkNPKTEUMBIGA1UECxMLKEVNIEJSQU5DTykxSDBGBgNVB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by5pY3BicmFzaWwuZ292LmJyL2xjci9TZXJhc2EvcmVwb3NpdG9yaW8vbGNyL3NlcmFzYWNkdjEuY3JsMIGXBggrBgEFBQcBAQSBijCBhzA8BggrBgEFBQcwAYYwaHR0cDovL29jc3AuY2VydGlmaWNhZG9kaWdpdGFsLmNvbS5ici9zZXJhc2FjZHYxMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3LmNlcnRpZmljYWRvZGlnaXRhbC5jb20uYnIvY2FkZWlhcy9zZXJhc2FjZHYxLnA3YjANBgkqhkiG9w0BAQUFAAOCAQEAd7MmYAs7y/0kc5FD/5p8Ze3V34PkT8Oy9uYVSQ2ng6QRRIKdnJquTasNspNYneFwTAYFPkRs+W9ThmmLUyk0kBW/R8b/bBjkpgvQA/teBa5EKys9sp26Zt07ef1J9uROZP8gna1en2uJmzYqr2N9S6TOBnsF2KiIExgjGETdxdwXNHc0i67uLXCzrfdRmihncXFoUbpbvp4QbYfFSGHICT0PPZ0TLS8Amjl7FkKP/i0OsR9QLt2kzUMxPFOE4dxtKdZsqlInyXjCsg/3PutldW66lxzRvWCoH+mSIxvMV32SPQry0+nwdhkYO3TYX3E6FmzgYJxDsmxr4DyV7qLnwg==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</cancNFe>
Citação::
OTAVIO,
Eu estava trabalhando sem essas tags antes e obtinha o mesmo resultado, mesmo sem elas...
Estou utilizando mecanismo de validação existente no código aqui disponibilizado...
meu código está assim:
Dim WS As New C_WebService(UrlAcesso)
Dim oNFE As New NFe
Dim oXMLCancelamento As New XmlDocument
Dim oXMLCancelamentoAssinado As New XmlDocument
Dim oCertificado As New X509Certificate2
Dim strResultadoValidacao As String
Dim retConsulta As RetEnvio
[ô]Preparando Informações de Cancelamento
[ô]-------------------------------------------------------------------------------------------------------------------------
oNFE.versao = [Ô]2.00[Ô]
oNFE.Id = [Ô]35100906988100000154550010000001281187229872[Ô]
oNFE.nProt = [Ô]135100026082158[Ô]
oNFE.xJust = [Ô]MOTIVO DO CANCELAMENTO[Ô]
oNFE.infNFE.Ide.tpAmb = [Ô]2[Ô]
oXMLCancelamento = oNFE.GerarXMLCancelamento()
[ô]Assinando o XML de Cancelamento
[ô]Selecionando o Certificado
[ô]-------------------------------------------------------------------------------------------------------------------------
oCertificado = CertificadoDigital.SelecionarCertificado([Ô]4EEF184BB922FA30[Ô])
[ô]Assinando o XML
[ô]-------------------------------------------------------------------------------------------------------------------------
If Not oCertificado Is Nothing Then
oXMLCancelamentoAssinado = New XmlDocument
oXMLCancelamentoAssinado = CertificadoDigital.Assinar(oXMLCancelamento, [Ô]infCanc[Ô], oCertificado) [ô]Assinando o XML
End If
[ô]Validando o XML Assinado
[ô]-------------------------------------------------------------------------------------------------------------------------
strResultadoValidacao = ValidaXML.ValidarXML(oXMLCancelamentoAssinado, [Ô]cancNFe_v2.00.xsd[Ô])
If strResultadoValidacao.Trim().Length > 0 Then
MsgBox([Ô]Falha na validação do XML![Ô] & vbCrLf & strResultadoValidacao)
Exit Sub
End If
[ô]Gerando arquivo XML de cancelamento
[ô]-------------------------------------------------------------------------------------------------------------------------
[ô]Importante:
[ô]Salvar através do TextWriter evita que o XML saia formatado no arquivo, desta forma o mesmo
[ô]pode ser rejeitado por alguns estados e/ou não validar nos programas teste
Using xmltw As New XmlTextWriter([Ô]C:cancelamento.xml[Ô], New UTF8Encoding(False))
oXMLCancelamentoAssinado.WriteTo(xmltw)
xmltw.Close()
End Using
[ô]---> QUANDO CHEGA AQUI O XML Gerado é o que consta abaixo (já validado e assinado)
[ô]Enviando XML de Cancelamento
[ô]-------------------------------------------------------------------------------------------------------------------------
WS.EnviaCancelamento([Ô]c:cancelamento.xml[Ô])
abaixo o conteúdo da sub EnviaCancelamento
Public Sub EnviaCancelamento(ByVal EndArquivoXml As String)
Dim strRetorno As XmlElement
Dim xmldoc = New XmlDocument()
Dim xmlRetorno As XmlNode
[ô]Carrega o arquivo XML
xmldoc.Load(EndArquivoXml)
Dim CERT As X509Certificate2
CERT = SelecionarCertificado([Ô]4EEF184BB922FA30[Ô])
Try
[ô]Dim wsMsg As Recepcao2.NfeRecepcao2
[ô]Dim cab As New Recepcao2.nfeCabecMsg
Dim wsMsg As NfeCancelamento2
[ô]UF E VERSÃO DO CABEÇALHO
[ô]cab.cUF = S_Url.CodigoUF
[ô]cab.versaoDados = VersaoAtualNfe
Dim Notas As String
[ô]CABEÇALHO USADA PARA ENVIO DE LOTE
[ô]wsMsg = New Recepcao2.NfeRecepcao2(S_Url.UrlNfeCancelamento)
wsMsg = New NfeCancelamento2(S_Url.UrlNfeCancelamento)
[ô]wsMsg.nfeCabecMsgValue = cab
wsMsg.Timeout = 100000
wsMsg.ClientCertificates.Add(CERT)
wsMsg.SoapVersion = SoapProtocolVersion.Soap12
Notas = xmldoc.OuterXml
[ô]RETORNO DA SEFAZ
[ô]strRetorno = wsMsg.nfeRecepcaoLote2(xmldoc)
xmlRetorno = wsMsg.nfeCancelamentoNF2(xmldoc)
xmldoc.LoadXml(xmlRetorno.InnerXml) [ô]---> Aqui eu já vejo o retorno com o XML de Falha no Schema de XML
[ô]... Codigo de tratamento de retorno ...
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, [Ô][Ô])
End Try
End Sub
Aqui está o XML que foi gerado (já validado e assinado).
<cancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]>
<infCanc Id=[Ô]ID35100906988100000154550010000001281187229872[Ô]>
<tpAmb>2</tpAmb>
<xServ>CANCELAR</xServ>
<chNFe>35100906988100000154550010000001281187229872</chNFe>
<nProt>135100026082158</nProt>
<xJust>MOTIVO DO CANCELAMENTO</xJust>
</infCanc>
<Signature xmlns=[Ô]http://www.w3.org/2000/09/xmldsig#[Ô]>
<SignedInfo>
<CanonicalizationMethod Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
<SignatureMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#rsa-sha1[Ô] />
<Reference URI=[Ô]#ID35100906988100000154550010000001281187229872[Ô]>
<Transforms>
<Transform Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#enveloped-signature[Ô] />
<Transform Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] />
</Transforms>
<DigestMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#sha1[Ô] />
<DigestValue>qdEV1VMBXQAj+hU9/uO460P2voI=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>BBFQeJ6oXlUI1ta2g7/QKNOWYIUk6WREOi6ArG712Yk29uA38gCzhScG1x3Sr/s3ZUqGIBmg/PplOUcDHb5IDi0VjcMg0Q0G1WmmWtRKHywI8wreGtpUdSk2vKZDuE27Oo4dsC+mav7Mkb8Z3uz1kUBJNo9m3oZ8Z/73cbSdq9o=</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>MIIGVzCCBT+gAwIBAgIITu8YS7ki+jAwDQYJKoZIhvcNAQEFBQAwTDELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxKDAmBgNVBAMTH1NFUkFTQSBDZXJ0aWZpY2Fkb3JhIERpZ2l0YWwgdjEwHhcNMTAwMzExMTMyNTUxWhcNMTEwMzExMTMyNTUxWjCCAQoxCzAJBgNVBAYTAkJSMRMwEQYDVQQKEwpJQ1AtQnJhc2lsMRQwEgYDVQQLEwsoRU0gQlJBTkNPKTEYMBYGA1UECxMPMDAwMDAxMDAwOTA1MTAzMRQwEgYDVQQLEwsoRU0gQlJBTkNPKTEUMBIGA1UECxMLKEVNIEJSQU5DTykxFDASBgNVBAsTCyhFTSBCUkFOQ08pMRQwEgYDVQQLEwsoRU0gQlJBTkNPKTEUMBIGA1UECxMLKEVNIEJSQU5DTykxSDBGBgNVBAMTP0RPQ0VTIEJSQVNJTCBDQUlQSVJBIElORFVTVFJJQSBFIENPTUVSQ0lPIERFIFBST0QgQUxJTS4gTFREQSBNRTCBnzANBgkqhkiG9w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A8BggrBgEFBQcwAYYwaHR0cDovL29jc3AuY2VydGlmaWNhZG9kaWdpdGFsLmNvbS5ici9zZXJhc2FjZHYxMEcGCCsGAQUFBzAChjtodHRwOi8vd3d3LmNlcnRpZmljYWRvZGlnaXRhbC5jb20uYnIvY2FkZWlhcy9zZXJhc2FjZHYxLnA3YjANBgkqhkiG9w0BAQUFAAOCAQEAd7MmYAs7y/0kc5FD/5p8Ze3V34PkT8Oy9uYVSQ2ng6QRRIKdnJquTasNspNYneFwTAYFPkRs+W9ThmmLUyk0kBW/R8b/bBjkpgvQA/teBa5EKys9sp26Zt07ef1J9uROZP8gna1en2uJmzYqr2N9S6TOBnsF2KiIExgjGETdxdwXNHc0i67uLXCzrfdRmihncXFoUbpbvp4QbYfFSGHICT0PPZ0TLS8Amjl7FkKP/i0OsR9QLt2kzUMxPFOE4dxtKdZsqlInyXjCsg/3PutldW66lxzRvWCoH+mSIxvMV32SPQry0+nwdhkYO3TYX3E6FmzgYJxDsmxr4DyV7qLnwg==</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</cancNFe>
amigo e como eu disse valide pelo site ou pelo validador que eu disponibilizei!!!!
assinatura invalidaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ou use o assinador que eu disponibilizei na pagina anterior! e coloque a uri correta!
obs: esse seu validador nao esta batendo bem verifique ele
abç
O validador que estou utilizando é justamente o que você disponibilizou...
E o assinador que estou utilizando também é o que você utilizou...
Testei tanto o validador que você disponibilizou no código original da classe NFe quando o contido na página 40 deste tópico, e ambos geram o mesmo XML.
Submeti o XML pelo validador do site e obtive o seguinte resultado:
Citação:
Resultado da Validação do Schema e Conferência da Assinatura:
PARSER XML: OK
TIPO DE MENSAGEM: Cancelamento - Pedido
SCHEMA: OK
ASSINATURA XML: Assinatura VÃLIDA
Eu estou usando quase que na sua totalidade códigos disponibilizados por você, Otávio, e devo agradecer muito pela colaboração, e justamente por isso que não consegui compreender a razão pela qual estou recebendo mensagem de retorno da SEFAZ/SP de falha (Rejeição: Cabeçalho - Falha no Schema XML).
Será que não existe alguma coisa que não estamos conseguindo [Ô]enxergar[Ô]...
Grato
Citação::
Otávio,
O validador que estou utilizando é justamente o que você disponibilizou...
E o assinador que estou utilizando também é o que você utilizou...
Testei tanto o validador que você disponibilizou no código original da classe NFe quando o contido na página 40 deste tópico, e ambos geram o mesmo XML.
Submeti o XML pelo validador do site e obtive o seguinte resultado:
Resultado da Validação do Schema e Conferência da Assinatura:
PARSER XML: OK
TIPO DE MENSAGEM: Cancelamento - Pedido
SCHEMA: OK
ASSINATURA XML: Assinatura VÃLIDA
Eu estou usando quase que na sua totalidade códigos disponibilizados por você, Otário, e devo agradecer muito pela colaboração, e justamente por isso que não consegui compreender a razão pela qual estou recebendo mensagem de retorno da SEFAZ/SP de falha (Rejeição: Cabeçalho - Falha no Schema XML).
Será que não existe alguma coisa que não estamos conseguindo [Ô]enxergar[Ô]...
Grato
bom e o seguinte eu coloco o seu xml para validar e esta dando como assinatura invalida!
verifique sua codificaçao de caracteres pois me parece isso!
ou algo no pc que vc esta desenvolvendo linguagen cofiguraçoes regionais! e meio complicado de dizer!
aki e um pedido de cancelamento valido
-------------------------------
<?xml version=[Ô]1.0[Ô] encoding=[Ô]UTF-8[Ô]?><cancNFe xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô] versao=[Ô]2.00[Ô]><infCanc Id=[Ô]ID35100908311856000190550010000006271796098903[Ô]><tpAmb>1</tpAmb><xServ>CANCELAR</xServ><chNFe>35100908311856000190550010000006271796098903</chNFe><nProt>135100488965611</nProt><xJust>foi faturado para razão social errada</xJust></infCanc><Signature xmlns=[Ô]http://www.w3.org/2000/09/xmldsig#[Ô]><SignedInfo><CanonicalizationMethod Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] /><SignatureMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#rsa-sha1[Ô] /><Reference URI=[Ô]#ID35100908311856000190550010000006271796098903[Ô]><Transforms><Transform Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#enveloped-signature[Ô] /><Transform Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] /></Transforms><DigestMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#sha1[Ô] /><DigestValue>2piRxVYAsZCZHa0G9i7pVzY2HNE=</DigestValue></Reference></SignedInfo><SignatureValue>OSCuY0+FQAKKe7xt8ophYgT9/WQHwDmNyBquLcdhXeIrV6flD15XM5KPPTPtJRVXfbBbdHuSVtqnfg0zJYvqsCfkEyadZ7Yea4WWrINrNVFQAOfK7Ddv17IMzp/mc6dBLAOlbDiD9IUgymq3OnVtv0N9yeBoz2Svlh2ayFbNZTE=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIGyzCCBbOgAwIBAgIQT7opixeNJmE7NFNnKplbzDANBgkqhkiG9w0BAQUFADCBgzELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxSDBGBgNVBAsTP1NJTkNPUi1TUCAtIFNpbmRpY2F0byBkb3MgQ29ycmV0b3JlcyBkZSBTZWd1cm9zIG5vIEVzdGFkbyBkZSBTUDEVMBMGA1UEAxMMQUMgU0lOQ09SIEcyMB4XDTEwMDIyNDAwMDAwMFoXDTEzMDIyMjIzNTk1OVowggEVMQswCQYDVQQGEwJCUjETMBEGA1UEChQKSUNQLUJyYXNpbDEuMCwGA1UECxQlQXV0ZW50aWNhZG8gcG9yIEFSIFNpbmNvciBQb2xvbWFzdGhlcjEbMBkGA1UECxQSQXNzaW5hdHVyYSBUaXBvIEEzMRQwEgYDVQQLFAsoRU0gQlJBTkNPKTEUMBIGA1UECxQLKEVNIEJSQU5DTykxFDASBgNVBAsUC0lEIC0gNjcwMjgwMTUwMwYDVQQDEyxJTVBBQ1RPIFBST0RVVE9TIE1FRElDT1MgRSBIT1NQSVRBTEFSRVMgTFREQTErMCkGCSqGSIb3DQEJAR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20uYnIvcmVwb3NpdG9yaW8vZHBjADAdBgNVHSUEFjAUBggrBgEFBQcDBAYIKwYBBQUHAwIwgZ0GCCsGAQUFBwEBBIGQMIGNMCgGCCsGAQUFBzABhhxodHRwOi8vb2NzcC5jZXJ0aXNpZ24uY29tLmJyMGEGCCsGAQUFBzAChlVodHRwOi8vaWNwLWJyYXNpbC5hY3NpbmNvci5jZXJ0aXNpZ24uY29tLmJyL3JlcG9zaXRvcmlvL2NlcnRpZmljYWRvcy9BQ19TSU5DT1JfRzIucDdjMA0GCSqGSIb3DQEBBQUAA4IBAQBicB6L99+IOPbvrUnoSS4RauuQsToIl9p6PF4rcE809ts7wpSgE8egn+rH6Q77y70RS1alEt37yYddQvbUAACb3NbIWBfJmG6N0BRDxENU+V/j9wtMhPHR7YSgU37NODPtBJEITxfsCq4z3g8ogd32xeto+UGA0Po2USV7pBZ7bu3y1sq3ILmZabhT63U0ZFygQr6Wbc1BP3UBuswZDEIbkmQECrpCP9PSknWGvwrLRNjF/6lEv4mjLz9zS8LkIFHGQrmUoeIqTslUi+cE6O+NptrrW8ITptb0sYg3aSYVGCoGZOiozbiNDc2HlF2beXR1OS1uSKAhIUWNIsTogUPl</X509Certificate></X509Data></KeyInfo></Signature></cancNFe>
-------------------------------------
olhe os dois anexos que eu postei!
e coloque isso no inicio do xml
<?xml version=[Ô]1.0[Ô] encoding=[Ô]UTF-8[Ô]?>
faz um teste eeeeeeeeeeeee faça a o envio como eu te mandei acima! sem as tags <procCancNFe>
pq vc so usa essas tags depois que vc obtem o retorno para forma um lote ja autorizado! como eu vou mandar abaixo!
<?xml version=[Ô]1.0[Ô] encoding=[Ô]UTF-8[Ô]?><procCancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]><cancNFe xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô] versao=[Ô]2.00[Ô]><infCanc Id=[Ô]ID35100908311856000190550010000006271796098903[Ô]><tpAmb>1</tpAmb><xServ>CANCELAR</xServ><chNFe>35100908311856000190550010000006271796098903</chNFe><nProt>135100488965611</nProt><xJust>foi faturado para razão social errada</xJust></infCanc><Signature xmlns=[Ô]http://www.w3.org/2000/09/xmldsig#[Ô]><SignedInfo><CanonicalizationMethod Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] /><SignatureMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#rsa-sha1[Ô] /><Reference URI=[Ô]#ID35100908311856000190550010000006271796098903[Ô]><Transforms><Transform Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#enveloped-signature[Ô] /><Transform Algorithm=[Ô]http://www.w3.org/TR/2001/REC-xml-c14n-20010315[Ô] /></Transforms><DigestMethod Algorithm=[Ô]http://www.w3.org/2000/09/xmldsig#sha1[Ô] /><DigestValue>2piRxVYAsZCZHa0G9i7pVzY2HNE=</DigestValue></Reference></SignedInfo><SignatureValue>OSCuY0+FQAKKe7xt8ophYgT9/WQHwDmNyBquLcdhXeIrV6flD15XM5KPPTPtJRVXfbBbdHuSVtqnfg0zJYvqsCfkEyadZ7Yea4WWrINrNVFQAOfK7Ddv17IMzp/mc6dBLAOlbDiD9IUgymq3OnVtv0N9yeBoz2Svlh2ayFbNZTE=</SignatureValue><KeyInfo><X509Data><X509Certificate>MIIGyzCCBbOgAwIBAgIQT7opixeNJmE7NFNnKplbzDANBgkqhkiG9w0BAQUFADCBgzELMAkGA1UEBhMCQlIxEzARBgNVBAoTCklDUC1CcmFzaWwxSDBGBgNVBAsTP1NJTkNPUi1TUCAtIFNpbmRpY2F0byBkb3MgQ29ycmV0b3JlcyBkZSBTZWd1cm9zIG5vIEVzdGFkbyBkZSBTUDEVMBMGA1UEAxMMQUMgU0lOQ09SIEcyMB4XDTEwMDIyNDAwMDAwMFoXDTEzMDIyMjIzNTk1OVowggEVMQswCQYDVQQGEwJCUjETMBEGA1UEChQKSUNQLUJyYXNpbDEuMCwGA1UECxQlQXV0ZW50aWNhZG8gcG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XBvc2l0b3Jpby9sY3IvQUNTSU5DT1JHMi9MYXRlc3RDUkwuY3JsMFCgTqBMhkpodHRwOi8vcmVwb3NpdG9yaW8uaWNwYnJhc2lsLmdvdi5ici9sY3IvQ2VydGlzaWduL0FDU0lOQ09SRzIvTGF0ZXN0Q1JMLmNybDBVBgNVHSAETjBLMEkGBmBMAQIDDjA/MD0GCCsGAQUFBwIBFjFodHRwOi8vaWNwLWJyYXNpbC5hY3NpbmNvci5jb20uYnIvcmVwb3NpdG9yaW8vZHBjADAdBgNVHSUEFjAUBggrBgEFBQcDBAYIKwYBBQUHAwIwgZ0GCCsGAQUFBwEBBIGQMIGNMCgGCCsGAQUFBzABhhxodHRwOi8vb2NzcC5jZXJ0aXNpZ24uY29tLmJyMGEGCCsGAQUFBzAChlVodHRwOi8vaWNwLWJyYXNpbC5hY3NpbmNvci5jZXJ0aXNpZ24uY29tLmJyL3JlcG9zaXRvcmlvL2NlcnRpZmljYWRvcy9BQ19TSU5DT1JfRzIucDdjMA0GCSqGSIb3DQEBBQUAA4IBAQBicB6L99+IOPbvrUnoSS4RauuQsToIl9p6PF4rcE809ts7wpSgE8egn+rH6Q77y70RS1alEt37yYddQvbUAACb3NbIWBfJmG6N0BRDxENU+V/j9wtMhPHR7YSgU37NODPtBJEITxfsCq4z3g8ogd32xeto+UGA0Po2USV7pBZ7bu3y1sq3ILmZabhT63U0ZFygQr6Wbc1BP3UBuswZDEIbkmQECrpCP9PSknWGvwrLRNjF/6lEv4mjLz9zS8LkIFHGQrmUoeIqTslUi+cE6O+NptrrW8ITptb0sYg3aSYVGCoGZOiozbiNDc2HlF2beXR1OS1uSKAhIUWNIsTogUPl</X509Certificate></X509Data></KeyInfo></Signature></cancNFe><retCancNFe versao=[Ô]2.00[Ô] xmlns=[Ô]http://www.portalfiscal.inf.br/nfe[Ô]><infCanc><tpAmb>1</tpAmb><verAplic>SP_NFE_PL_006e</verAplic><cStat>101</cStat><xMotivo>Cancelamento de NF-e homologado</xMotivo><cUF>35</cUF><chNFe>35100908311856000190550010000006271796098903</chNFe><dhRecbto>2010-09-10T14:07:05</dhRecbto><nProt>135100489118926</nProt></infCanc></retCancNFe></procCancNFe>
abç
[ô]Dim cab As New Recepcao2.nfeCabecMsg
Dim wsMsg As NfeCancelamento2
[ô]UF E VERSÃO DO CABEÇALHO
[ô]cab.cUF = S_Url.CodigoUF
[ô]cab.versaoDados = VersaoAtualNfe
Dim Notas As String
[ô]CABEÇALHO USADA PARA ENVIO DE LOTE
[ô]wsMsg = New Recepcao2.NfeRecepcao2(S_Url.UrlNfeCancelamento)
wsMsg = New NfeCancelamento2(S_Url.UrlNfeCancelamento)
[ô]wsMsg.nfeCabecMsgValue = cab[txt-size=2] [/txt-size]
o meu e assim
Dim vStringLoteNfe As String
vStringLoteNfe = dll_rocket_nfe.rocket_Funcao.TextoXMLCancelamentoAssinado
Dim myXMLDoc As New System.Xml.XmlDocument
myXMLDoc.PreserveWhitespace = True
myXMLDoc.LoadXml(vStringLoteNfe)
Dim NfeServico As Cancelamento2.NfeCancelamento2 [ô][ô]funciona com web reference ou so reference os dois metos funciona aki perfeito!
Dim nfeCabecMsg As New Cancelamento2.nfeCabecMsg [ô][ô]funciona com web reference ou so reference os dois metos funciona aki perfeito!
NfeServico = New Cancelamento2.NfeCancelamento2(rocket_Funcao.UrlNfeCancelamento)
nfeCabecMsg.versaoDados = [Ô]2.00[Ô]
nfeCabecMsg.cUF = rocket_Funcao.vUF
NfeServico.nfeCabecMsgValue = nfeCabecMsg
[ô][ô]NfeServico.Url = rocket_Funcao.UrlNfeCancelamento
NfeServico.SoapVersion = SoapProtocolVersion.Soap12
NfeServico.ClientCertificates.Add(rocket_Certificado.oCertificado)
Dim Retorno As New XmlDocument
Retorno.LoadXml(NfeServico.nfeCancelamentoNF2(myXMLDoc).OuterXml)
dll_rocket_nfe.rocket_Funcao.TextoXML = Retorno.InnerXml
NfeServico.Dispose()
olha os caminhos das pedras acima!!!! na minha opiniao esse e o metodo perfeito de enviar um xml para a sefaz 2.00 para tudo cancelar, recep, retrecep, inutili e outrossss.....! 100% testado e aprovado por mim!