EFD-Reinf - Invalid batch version. Version 1.04.00 must be used

Asked

Viewed 648 times

0

I am generating the R-1000 record for shipping test in the EFD-Reinf restricted production environment, and I already got help here at Sopt same: How to consume EFD-Reinf Webservice in C#? (Sending Events).

I was able to authenticate and consume the service successfully, but the return of the sent XML says the version is invalid:

Invalid batch version. Use version 1.04.00.

When I point to the new: http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v1_04_00

I’ve researched here on Sopt, including the post: C# EFD-REINF 1.03.02 - Invalid event signature. Invalid XML document Digital signature, but I didn’t find the cause of the problem.

Follow the XML I’m sending, unsigned:

<?xml version="1.0" encoding="utf-8"?>
   <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sped="http://sped.fazenda.gov.br/">
  <soap:Header />
  <soap:Body>
    <REINF xmlns="http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v1_04_00">
      <loteEventos>
        <evento id="ID1">
          <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evtInfoContribuinte/v1_04_00">
            <evtInfoContri id="20181121110000000000000001">
              <ideEvento>
                <tpAmb>2</tpAmb>
                <procEmi>1</procEmi>
                <verProc>1.0</verProc>
              </ideEvento>
              <ideContri>
                <tpInsc>1</tpInsc>
                <nrInsc>01628604</nrInsc>
              </ideContri>
              <infoContri>
                <inclusao>
                  <idePeriodo>
                    <iniValid>2018-01</iniValid>
                  </idePeriodo>
                  <infoCadastro>
                    <classTrib>99</classTrib>
                    <indEscrituracao>1</indEscrituracao>
                    <indDesoneracao>0</indDesoneracao>
                    <indAcordoIsenMulta>0</indAcordoIsenMulta>
                    <indSitPJ>0</indSitPJ>
                    <contato>
                      <nmCtt>XXXX</nmCtt>
                      <cpfCtt>XXX</cpfCtt>
                      <foneFixo>(011)XXXX6427</foneFixo>
                      <email>XXXXX</email>
                    </contato>
                  </infoCadastro>
                </inclusao>
              </infoContri>
            </evtInfoContri>
          </Reinf>
        </evento>
      </loteEventos>
    </REINF>
  </soap:Body>
</soap:Envelope>

XML with the signature:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sped="http://sped.fazenda.gov.br/">
  <soap:Header />
  <soap:Body>
    <REINF xmlns="http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v1_04_00">
      <loteEventos>
        <evento id="ID1">
          <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evtInfoContribuinte/v1_04_00">
            <evtInfoContri id="20181121110000000000000001">
              <ideEvento>
                <tpAmb>2</tpAmb>
                <procEmi>1</procEmi>
                <verProc>1.0</verProc>
              </ideEvento>
              <ideContri>
                <tpInsc>1</tpInsc>
                <nrInsc>01628604</nrInsc>
              </ideContri>
              <infoContri>
                <inclusao>
                  <idePeriodo>
                    <iniValid>2018-01</iniValid>
                  </idePeriodo>
                  <infoCadastro>
                    <classTrib>99</classTrib>
                    <indEscrituracao>1</indEscrituracao>
                    <indDesoneracao>0</indDesoneracao>
                    <indAcordoIsenMulta>0</indAcordoIsenMulta>
                    <indSitPJ>0</indSitPJ>
                    <contato>
                      <nmCtt>xxx</nmCtt>
                      <cpfCtt>xxx</cpfCtt>
                      <foneFixo>(011)xxx</foneFixo>
                      <email>xxxx</email>
                    </contato>
                  </infoCadastro>
                </inclusao>
              </infoContri>
            </evtInfoContri>
          </Reinf>
        </evento>
      </loteEventos>
    </REINF>
  </soap:Body>
  <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/2001/04/xmldsig-more#rsa-sha256" />
      <Reference URI="">
        <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/2001/04/xmlenc#sha256" />
        <DigestValue>Mv9GEVe2dZ4zstZhfcp0xok3OHolN5kjUNtMDvG1uF4=</DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue>DUE7Q+LguONd8cDbPZHqC9ObqG51Um5Oh4v7I5fMw43zIQQeeMbhF2j1GrbKg0poFW134OUB1dFXZyXMEQ/ynrNXkRXT1zZAXgQ0jFtfUA6MIjDCUoE68Q/bNDG7N28A1loXqAILKMmVr8WGg73UA9rDU9wMTTWy9yOfN712yqFA5RJzp53wpVX6BmjC05lfRblslEcSZTvQg2QbgLh+FBRIubznVn+sFuZ5hAB6QggCumSyxVBrpeLPyvlpSPvQM2xHw4IO3bFSq2BqPHSePU3lLyl+8/irlOLUGYSSX77m8hmBOpKzmqBqjX+v8E6QLHLEUpXcN0HT3Y5bGMByrQ==</SignatureValue>
    <KeyInfo>
      <X509Data>
        <X509Certificate>MIIHqzCCBZOgAwIBAgIIXu2i7LwvfWswDQYJKoZIhvcNAQELBQAwdTELMAkGA1UEBhMCQlIxEzARBgNVBAoMCklDUC1CcmFzaWwxNjA0BgNVBAsMLVNlY3JldGFyaWEgZGEgUmVjZWl0YSBGZWRlcmFsIGRvIEJyYXNpbCAtIFJGQjEZMBcGA1UEAwwQQUMgU0VSQVNBIFJGQiB2NTAeFw0xODA0MDUxNDEzMDBaFw0xOTA0MDUxNDEzMDBaMIHpMQswCQYDVQQGEwJCUjELMAkGA1UECAwCU1AxEjAQBgNVBAcMCVNBTyBQQVVMTzETMBEGA1UECgwKSUNQLUJyYXNpbDE2MDQGA1UECwwtU2VjcmV0YXJpYSBkYSBSZWNlaXRhIEZlZGVyYWwgZG8gQnJhc2lsIC0gUkZCMRYwFAYDVQQLDA1SRkIgZS1DTlBKIEExMRIwEAYDVQQLDAlBUiBTRVJBU0ExQDA+BgNVBAMMN1NFUkJPTSBBUk1BWkVOUyBHRVJBSVMgRlJJR09SSUZJQ09TIExUREE6MDE2Mjg2MDQwMDAxNDAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCOnWMGJ7BUp1dnOdabMln8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HwSBlTCBkjBKoEigRoZEaHR0cDovL3d3dy5jZXJ0aWZpY2Fkb2RpZ2l0YWwuY29tLmJyL3JlcG9zaXRvcmlvL2xjci9zZXJhc2FyZmJ2NS5jcmwwRKBCoECGPmh0dHA6Ly9sY3IuY2VydGlmaWNhZG9zLmNvbS5ici9yZXBvc2l0b3Jpby9sY3Ivc2VyYXNhcmZidjUuY3JsMA4GA1UdDwEB/wQEAwIF4DANBgkqhkiG9w0BAQsFAAOCAgEAQw2Mx0UHeMMxcpnKV2GJNwn18GVC1yXNPkV7c79DQvY+BgvbcnK6rV94hnnHzOjEs4hn9b8J9Mf53IGYgRGpErVELC/ddrOu9ZiqtulsFKC24YMXugtYaikzK4oUHrDD83ZptwTgyO1ZS1C/rUuIfwpi4+KCO7IORBaTghNHf+ficpR3oSebJ64mwbJQfeCfHadFr1kbGOjZeh4flD1Qp2Nzzmx6QI51PuDFpyYmjej9T2WuC/UhhaTwffwM2dpqAIHASSjinAjeb9JC9v6ZJhMZ210sPVut0/xkdPMQSXDiyljlle9Iymk7R4DC+cO1DbrHlliedvKUF2fJJjfvqxQ5ZRm1EngV69TqfPz/32tHjOpum86QCm/hzn+aEuZ+2R2XWEVvJSB1m4ckm/A2N8C2zyha+a9GMgZyouWQ3MDwAOR0dIzkV+85rGM7Thg1D9CQoDkq7LExZze20ROvaLcg0RbcJLCu4kSSpUM1mb8x2uPa2ExmSz/CniRSLx+LJSaq2vYNuK5LrOiw7cOy7aSUTU4tu4jCimaCB6EN3wzgKxzaGHGQcjI4aiuhssM0iH4sMNUKhcadCLRoxeXKQBgBKn1Ab3uANfLdHxrCxGcoPhsBfztX2xzMpk+rHnD849yRnE3OWGwrBVRz38T7jA1cJ9s/fJz1agg8VASmYv4=</X509Certificate>
      </X509Data>
    </KeyInfo>
  </Signature>
</soap:Envelope>

The full return XML:

<Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00">
  <retornoLoteEventos id="IDCE8ED92E6A9124FCD401AFF46756541E">
    <ideTransmissor>
      <IdTransmissor>01628604000140</IdTransmissor>
    </ideTransmissor>
    <status>
      <cdStatus>1</cdStatus>
      <descRetorno>ERRO</descRetorno>
      <dadosRegistroOcorrenciaLote>
        <ocorrencias>
          <tipo>1</tipo>
          <codigo>MS0092</codigo>
          <descricao>Versão do lote inválida. Deve ser utilizada a versão 1.04.00.</descricao>
        </ocorrencias>
      </dadosRegistroOcorrenciaLote>
    </status>
  </retornoLoteEventos>
  <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/2001/04/xmldsig-more#rsa-sha256" />
      <Reference URI="#IDCE8ED92E6A9124FCD401AFF46756541E">
        <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/2001/04/xmlenc#sha256" />
        <DigestValue>gRHi6NxvLDuhFO2Q2jB+Nl7B450LCzRynii+Mo10ZWE=</DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue>CmbAd77rYGrwWkFSw+Hx4BqnbV7bgjGfnnw2Y1TkQt1HYJIjoe7JcjBO8v/BFmg0vzHMU4CLr4GuryhMFFP1m6ED/OhAbH1DAqwmPITypfSnLTZno5ILgxtV1mxic88oYY3VebPZnAeINg7OK1u+J3tQMmpEuTx0ew7kY5wIFOW+Fa2bUQXGRqrLP2r5C7Gmt+b/Z0mHxLAaeb/qwdhxqnyDVuCayFo93dI5rREP9WgQhTijwRv8k0uBQ94bOzv12kcF15w00rg3F/1bo6Vy8iSzFc9OtEl0C5tUMC765QnfFChdWdkT9BtQwVnKiOHTGISixa9EHpzjEv24cGvrPA==</SignatureValue>
    <KeyInfo>
      <X509Data>
        <X509Certificate>MIIHcTCCBVmgAwIB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8/uCY9lFsU5homfDxVhYgbHAjRpu9ItAomguKx82YJVUenHy7Oyi6u+QBOQZZuBnCrLgUDKqXKwGSh0qEI5m0uTZ9JE/MYMsJkr+iBUa9cM9r2UBwEslbzu4k6xrCCTawCoyMpd+LolKDLtl4gdveF7gzpBMyX90xT/TsqOhV94WRLLdcYEAAbpv+S+BaCPUXcEkD/1gWygQW5/P+jV88dAKLzL5lBX7k7pywZg27IXSB4IDUUJexCRpMehubTLG9gK9ua9JKmhHgNFCnche8+IrUyuFeyxUuLB0/4GJ152gsYlRdQs69GgzZa2YIEoo7dgw7vskTY9LVyvqybTY2MBzh+Wn0ktFwnkCSdyXegloQxWQqaakpzCwCo3tJPUDdU6EA2w==</X509Certificate>
      </X509Data>
    </KeyInfo>
  </Signature>
</Reinf>

EDITION You’re right, I didn’t realize that the subscription should be by event and not by lot.

About "The correct form of your Soap:Envelope should be this one": made the edit as indicated, but keeps returning the same wrong batch message:

{<Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00">
  <retornoLoteEventos id="ID54ED726E636E2B6F9FD4FD7077870873">
    <ideTransmissor>
      <IdTransmissor>01628604000140</IdTransmissor>
    </ideTransmissor>
    <status>
      <cdStatus>1</cdStatus>
      <descRetorno>ERRO</descRetorno>
      <dadosRegistroOcorrenciaLote>
        <ocorrencias>
          <tipo>1</tipo>
          <codigo>MS0092</codigo>
          <descricao>Versão do lote inválida. Deve ser utilizada a versão 1.04.00.</descricao>
        </ocorrencias>
      </dadosRegistroOcorrenciaLote>
    </status>
  </retornoLoteEventos>
  <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/2001/04/xmldsig-more#rsa-sha256" />
      <Reference URI="#ID54ED726E636E2B6F9FD4FD7077870873">
        <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/2001/04/xmlenc#sha256" />
        <DigestValue>PkXxGAtPdkWYgZ21TLotsVYYE7mPLGnmpmLMXI65gnQ=</DigestValue>
      </Reference>
    </SignedInfo>
     [...]</SignatureValue>
    <KeyInfo>
      <X509Data>
        <X509Certificate> [...]</X509Certificate>
      </X509Data>
    </KeyInfo>
  </Signature>
</Reinf>}
    BaseUri: ""
    Document: null
    FirstAttribute: {xmlns="http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00"}
    FirstNode: {<retornoLoteEventos id="ID54ED726E636E2B6F9FD4FD7077870873" xmlns="http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00">
  <ideTransmissor>
    <IdTransmissor>01628604000140</IdTransmissor>
  </ideTransmissor>
  <status>
    <cdStatus>1</cdStatus>
    <descRetorno>ERRO</descRetorno>
    <dadosRegistroOcorrenciaLote>
      <ocorrencias>
        <tipo>1</tipo>
        <codigo>MS0092</codigo>
        <descricao>Versão do lote inválida. Deve ser utilizada a versão 1.04.00.</descricao>
      </ocorrencias>
    </dadosRegistroOcorrenciaLote>
  </status>
</retornoLoteEventos>}
    HasAttributes: true
    HasElements: true
    IsEmpty: false
    LastAttribute: {xmlns="http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00"}
    LastNode: {<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/2001/04/xmldsig-more#rsa-sha256" />
    <Reference URI="#ID54ED726E636E2B6F9FD4FD7077870873">
      <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/2001/04/xmlenc#sha256" />
      <DigestValue>PkXxGAtPdkWYgZ21TLotsVYYE7mPLGnmpmLMXI65gnQ=</DigestValue>
    </Reference>
  </SignedInfo>
  <SignatureValue>NaDYeZv3gFDBH41BY5j8hcYXHhpdx+hjFWCIYvLaBxAVWNUUaAZixzV3Bld4Lul3m0yKL6Hq16xmKYiA55tCPbZWWy+YymnCtj3OC7rZPv2lQZZyTK6DiLugIIiUyk7TsTd1rZmT6D55OxwJfpmb1M+rQLK6siYAZmI2pguUX0NvKITIaaxUD6HGZOgO6cc9VGRR7PTxjhkl0j0jcwFPxCEvk8cTbT0PnkkLw1v5zPBC1nvgpz3Kn+fG11qkTwEIIdNonx/O1i7ZdvpLUe7/MXEYNbip/lcrGL/zapBHNTsLgN6NNI7QUUuPIPB4yMhpQcNA9FfzEgzdZVhbDzdLeQ==</SignatureValue>
  <KeyInfo>
    <X509Data>
      <X509Certificate> [...]</X509Certificate>
    </X509Data>
  </KeyInfo>
</Signature>}
    Name: {{http://www.reinf.esocial.gov.br/schemas/retornoLoteEventos/v1_04_00}Reinf}
    NextNode: null
    NodeType: Element
    Parent: null
    PreviousNode: null
    Value: "016286040001401ERRO1MS0092Versão do lote inválida. Deve ser utilizada a versão 1.04.00.PkXxGAtPdkWYgZ21TLotsVYYE7mPLGnmpmLMXI65gnQ=NaDYeZv3gFDBH41BY5j8hcYXHhpdx+hjFWCIYvLaBxAVWNUUaAZixzV3Bld4Lul3m0yKL6Hq16xmKYiA55tCPbZWWy+YymnCtj3OC7rZPv2lQZZyTK6DiLugIIiUyk7TsTd1rZmT6D55OxwJfpmb1M+rQLK6siYAZmI2pguUX0NvKITIaaxUD6HGZOgO [...]"

I cannot post my XML here for character limitation.

  • Vagner, the return was truncated, post the return XML in the message, following the format pattern of the edit I made.

  • I reedited the question to post formatted.

  • Vagner, but when you say you "did the editing," you didn’t do it manually, right? Because if you change anything in the file after it is signed, it will go wrong. So, your program has to take only the XML of the event (that <Reinf> with xmlns=".../evtInfoContribuinte/...), sign and embed the signature inside it. Then this event XML, signed, you embed inside the lot (the <Reinf> with xmlns=".../envioLoteEventos/...), and cannot have any changes to the event’s XML afterward signed.

  • Sorry it took me so long to reply. For testing, I manually concatenated the Batch XML + Event XML signed, without changing the XML of the signed event. But all right, I’d like to know what and how you did to unite the 2 XML. Initially I thought of Xmltextwriter to go creating element by element of XML Batch. In the middle of it, I thought about importing the XML from the signed Event and moving it to Xmltextwriter. How did you do this?

  • 1

    What I do is more or less what is here in this answer: REINF - Invalid Signature, then serializo the object of the lot to an object XElement and then I call the method xElementLote.Save(nomeArquivo).

  • Vagner, did you manage to generate a signed event and embed it in the batch via code? If applicable, open another question on this subject. My answer answered your original question?

  • Peter, unfortunately I didn’t have time to apply your suggestion due to other emergencies here. I believe that on Monday I can test and reply in the post. Thank you

  • Pedro, I don’t have much experience generating XML in this way, so maybe my questions are very "basic". My question at this point is this: Can I successfully generate and validate XML without serializing? Because I started generating it this way: From the layout of the event, I used Xmltexwriter to generate element to element of the XML element with their respective values until finalizing the file for later sending (webservice consumption).

  • 1

    You need to serialize, but not necessarily record on disc. To serialize, in this case, is to transform your object into an XML, even if that XML is only in memory. Here I send to the service without even saving to disk, I send the XML in memory even, because at the time of sending the XML to the service you have to load it in memory anyway, in an object XElement.

Show 4 more comments

1 answer

1


XML by default is case sensitive (case-sensitive), and you called the root element of the lot as <REINF>, but the XSD scheme says that the name should be <Reinf>. Change this and see if it resolves.


References:


EDITION

I hadn’t noticed at first, but the problem is in the signature. Here’s another answer that talks about this: XML signing error for EFD-Reinf.

But basically, your R-1000 event should be like this, with the signature built in within his:

      <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evtInfoContribuinte/v1_04_00">
        <evtInfoContri id="20181121110000000000000001">
            [...]
        </evtInfoContri>
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
            [...]
        </Signature>            
      </Reinf>

You’re putting the signature after the soap:Body, what’s wrong:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sped="http://sped.fazenda.gov.br/">
  <soap:Header />
  <soap:Body>
    <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v1_04_00">
      <loteEventos>
        <evento id="ID1">
          <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evtInfoContribuinte/v1_04_00">
            <evtInfoContri id="20181121110000000000000001">
              [...]
            </evtInfoContri>
          </Reinf>
        </evento>
      </loteEventos>
    </REINF>
  </soap:Body>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    [...]
  </Signature>
</soap:Envelope>

The shape correct of your soap:Envelope should be this:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sped="http://sped.fazenda.gov.br/">
  <soap:Header />
  <soap:Body>
    <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/envioLoteEventos/v1_04_00">
      <loteEventos>
        <evento id="ID1">
          <Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evtInfoContribuinte/v1_04_00">
            <evtInfoContri id="20181121110000000000000001">
              [...]
            </evtInfoContri>
            <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
              [...]
            </Signature>
          </Reinf>
        </evento>
      </loteEventos>
    </REINF>
  </soap:Body>
</soap:Envelope>
  • Yes.. I changed but keeps returning the same invalid version message.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.