Reinf - Error with event R-5011

1

When trying to sign the R-5011 query event, I'm encountering this error:

  

"The ' link ' element is invalid - The value '4308-2099 -1701-4308 'is invalid depending on data type' String '- The current length is not equal to the specified length. "

This is the event xml before signing:

<?xml version="1.0" encoding="UTF-8"?>
<Reinf xmlns="http://www.reinf.esocial.gov.br/schemas/evtTotalContrib/v1_03_00">
    <evtTotalContrib id="ID1102200480000002018041218075500001">
        <ideEvento>
            <perApur>2017-01</perApur>
        </ideEvento>
        <ideContri>
            <tpInsc>1</tpInsc>
            <nrInsc>10220048</nrInsc>
        </ideContri>
        <ideRecRetorno>
            <ideStatus>
                <cdRetorno>2</cdRetorno>
                <descRetorno>EM PROCESSAMENTO</descRetorno>
            </ideStatus>
        </ideRecRetorno>
        <infoRecEv>
            <nrProtEntr>4308-2099-1701-4308</nrProtEntr>
            <dhProcess>2018-04-12T18:07:55</dhProcess>
            <tpEv>2099</tpEv>
            <idEv>ID1102200480000002018040914443600001</idEv>
            <hash>Wh6iWTlvKY+tApuALf0IFC0+u86EulO4oUNjTF6R/mY=</hash>
        </infoRecEv>
        <infoTotalContrib>
            <nrRecArqBase>4308-05-2099-1701-4308</nrRecArqBase>
            <indExistInfo>3</indExistInfo>
        </infoTotalContrib>
    </evtTotalContrib>
</Reinf>

Could someone tell me how to fix this?

    
asked by anonymous 12.04.2018 / 23:24

1 answer

1

After the messages that we exchanged in the comments, I did a search here and saw that this event really R-5011 "Consolidated information for bases and taxes by calculation period" in>, with name evtTotalContrib , defined in the 'returnTotalizerContribution-v1_03_02.xsd' file) is really just a return event, ie you do not need to fill it out, sign it and send it it is EFD-Reinf that will fill in, sign and return this event to you in the query.

I took a while to understand the query (which they released shortly), because its schema is slightly different from eSocial, and the EFD-Reinf send WebService itself.

I do not know if you already know, and if you have already written the routine for the query, but the address to access the EFD-Reinf query WebService is this one:

  

link

And the WSDL address, to add a reference to the query service in your project, is this here:

  

link

But the Query Service WSDL can also be downloaded from this other address:

  

link

I have noticed that the input parameters for the query service are already set forward in the WSDL, not in a .XSD file, as in the case of eSocial and the EFD-Reinf send service:

<wsdl:types>
    <xs:schema elementFormDefault="qualified" targetNamespace="http://sped.fazenda.gov.br/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="ConsultaInformacoesConsolidadas">
            <xs:complexType>
                <xs:sequence>
                    <xs:element minOccurs="1" maxOccurs="1" name="tipoInscricaoContribuinte" type="xs:unsignedByte"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="numeroInscricaoContribuinte" type="xs:string"/>
                    <xs:element minOccurs="0" maxOccurs="1" name="numeroReciboFechamento" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
        </xs:element>
        [...]
    </xs:schema>
</wsdl:types>

Then I created a test project, I added the reference to the service (I called the service's namespace added by WsConsults ) and I verified that the query would look like this:

var urlServicoConsulta = @"https://preprodefdreinf.receita.fazenda.gov.br/ConsultasReinf.svc";
var address = new System.ServiceModel.EndpointAddress(urlServicoConsulta);
var binding = new System.ServiceModel.BasicHttpsBinding();  //Disponível desde .NET Framework 4.5
// ou:
//var binding = new System.ServiceModel.BasicHttpBinding(BasicHttpsSecurityMode.Transport);
binding.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Certificate;

// Instancia o cliente para acessar o serviço de consulta do EFD-Reinf.
var wsClient = new WsConsultas.ConsultasReinfClient(binding, address);
wsClient.ClientCredentials.ClientCertificate.Certificate = x509Cert;

// Solicita uma consulta, passando os parâmetros e recebendo o evento R-5011 como retorno.
System.Xml.Linq.XElement retornoTotalContrib = wsClient.ConsultaInformacoesConsolidadas(1, "10220048", "4308-2099-1701-4308");
wsClient.Close();

You can read a bit more about this query service in the Developer's Guide v1.3 , page 43 to page 53:

  

link

    
13.04.2018 / 20:18