Jump to content
Fivewin Brasil

e-social


oliveiros

Recommended Posts

Pessoal, boa noite!

Preciso de ajuda para identificar o que está errado nesta xml do e-social. Quando envio só volta 400 - Bad Request?

<?xml version="1.0" encoding="ISO-8859-1"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<eSocial xmlns="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">
<envioLoteEventos grupo="1">
<ideEmpregador>
<tpInsc>1</tpInsc>
<nrInsc>0000000</nrInsc>
</ideEmpregador>
<ideTransmissor>
<tpInsc>1</tpInsc>
<nrInsc>0000000000000000</nrInsc>
</ideTransmissor>
<eventos>
<evento Id="ID10000001001000201901">
<eSocial xmlns="http://www.esocial.gov.br/schema/evt/evtInfoEmpregador/v02_04_02">
<evtInfoEmpregador Id="ID10000001001000201901">
<ideEvento>
<tpAmb>2</tpAmb>
<procEmi>1</procEmi>
<verProc>SISFolha 32780</verProc>
</ideEvento>
<ideEmpregador>
<tpInsc>1</tpInsc>
<nrInsc>00000000</nrInsc>
</ideEmpregador>
<infoEmpregador>
<inclusao>
<idePeriodo>
<iniValid>2018-08</iniValid>
</idePeriodo>
<infoCadastro>
<nmRazao>...</nmRazao>
<classTrib>10</classTrib>
<natJurid>3131</natJurid>
<indCoop>0</indCoop>
<indConstr>0</indConstr>
<indDesFolha>0</indDesFolha>
<indOptRegEletron>1</indOptRegEletron>
<indEntEd>N</indEntEd>
<indEtt>N</indEtt>
<contato>
<nmCtt>...</nmCtt>
<cpfCtt>...</cpfCtt>
<foneFixo>...</foneFixo>
</contato>
<softwareHouse>
<cnpjSoftHouse>...</cnpjSoftHouse>
<nmRazao>AM2 SERVICOS DE INFORMATICA LTDA</nmRazao>
<nmCont>...</nmCont>
<telefone>...</telefone>
<email>am2.tecnologia@uol.com.br</email>
</softwareHouse>
<infoComplementares>
<situacaoPJ>
<indSitPJ>0</indSitPJ>
</situacaoPJ>
</infoComplementares>
</infoCadastro>
</inclusao>
</infoEmpregador>
</evtInfoEmpregador>
<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>BjeyC0pkTbpTqHOnsUN8H0bq4S3hG2GTtqqvy0wdaq4=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>...</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>...</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
</eSocial>
</evento>
</eventos>
</envioLoteEventos>
</eSocial>
</soap:Body>
</soap:Envelope>

Desde  já agradeço a atenção.

Oliveiros Junior

 

 

Link to comment
Share on other sites

tenta assim:

<?xml version="1.0" encoding="ISO-8859-1"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<EnviarLoteEventos xmlnm="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">
<eSocial xmlns="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">
<envioLoteEventos grupo="1">
<ideEmpregador>
 

qual programa externo esta usando?

Link to comment
Share on other sites

Olá Alain,

1- Para assinar estou utilizando XML Sign.exe;

2- O código do manual e-Social encoding="utf-8"; está informação está na primeira linha do XML mas na hora de mostrar no browser aparece encoding="ISO-8859-1".

3- Peguei um exemplo de XML já recebido pelo e-Social e comparei com o meu e acho que o problema esta no envelopamento. Você tem alguma idéia? 

Att.,

Oliveiros Junior

 

 

 

Link to comment
Share on other sites

tenta assim:

           
            xXml:='<?xml version="1.0" encoding="utf-8"?>'
            xXml+='<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
            xXml+='<soap:Body>'
            xXml+='<EnviarLoteEventos xmlnm="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">'
            xXml+='<eSocial xmlns="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">'

            if oArq="EVTINI"
               xXml+='<envioLoteEventos grupo="1">'
            elseIf oArq="EVTNPER"
               xXml+='<envioLoteEventos grupo="2">'
            elseIf oArq="EVTPER"
               xXml+='<envioLoteEventos grupo="3">'
            endif

            xXml+='<ideEmpregador>'

 

Link to comment
Share on other sites

Olá Alain,

Esse código é do xml aberto no meu browser:

<?xml version="1.0" encoding="ISO-8859-1"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<EnviarLoteEventos xmlnm="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">
<eSocial xmlns="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">
<envioLoteEventos grupo="1">
<ideEmpregador>

Este é da codificação:
  cEnvelope_XML := '<?xml version="1.0" encoding="utf-8"?>'
  cEnvelope_XML += '<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'
  cEnvelope_XML += '<soap:Body>'
  cEnvelope_XML += '<EnviarLoteEventos xmlnm="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">'
  cEnvelope_XML += '<eSocial xmlns="http://www.esocial.gov.br/schema/lote/eventos/envio/v1_1_1">'
  cEnvelope_XML += '<envioLoteEventos grupo="1">'
  cEnvelope_XML += '<ideEmpregador>'
 

Estou usando no soap:

URL := https://webservices.producaorestrita.esocial.gov.br/servicos/empregador/enviarloteeventos/WsEnviarLoteEventos.svc

Action := http://www.esocial.gov.br/servicos/empregador/lote/eventos/envio/v1_1_0/ServicoEnviarLoteEventos/EnviarLoteEventos

E o retorno agora é: Resposta: Erro - Argument error

Não estou entendo agora onde é o erro. 

Att.,

Oliveiros Junior

 

 

 

Link to comment
Share on other sites

Olá Alain,

Você possui uma rotina de envio? Estou usando esta abaixo, mas não envia de jeito algum:

Function Transmitir_XML( cXML )
  Local oServer, cCertificado, cSoapAction, cURL_Envio, cRetorno

 cCertificado:= "nome do certificado"

 cSOAPAction := "http://www.esocial.gov.br/servicos/empregador/lote/eventos/envio/v1_1_0/ServicoEnviarLoteEventos/EnviarLoteEventos"  

 cURL_Envio:="https://webservices.producaorestrita.esocial.gov.br/servicos/empregador/enviarloteeventos/WsEnviarLoteEventos.svc"  

  //
  *----------------------------------------------------------------------------*
  TRY
     oServer := CreateObject( 'MSXML2.ServerXMLHTTP.6.0' )
  CATCH
     oServer := CreateObject( 'MSXML2.XMLHTTP' )
  END

  oServer:Open( "POST", cURL_Envio, .F. )
  oServer:SetRequestHeader( "SOAPAction", cSOAPAction )
  oServer:SetRequestHeader( "Content-Type", "text/xml; charset=utf-8" )
     
   oServer:Send( cXML )
   oServer:WaitForResponse( 500 )
     
   cRetorno := oServer:ResponseBody()

   ? cRetorno

Return .T.

 

Att.,

Oliveiros Junior

Link to comment
Share on other sites

referente ao erro 400, olhem o que diz, em perguntas e repostas no site do e-social:

 

01.05 - (11/01/2018) Tentando a conexão com o Webservice, o serviço retorna: “a solicitação falhou com status HTTP 400: Bad Request”. Por quê?

Acessos que retornam falhas de status HTTP 400 são por motivo de solicitação inválida. A solicitação não pôde ser entendida pelo servidor devido à sintaxe incorreta, sendo aconselhado não repetir a solicitação sem os devidos ajustes. Deve ser utilizada exatamente a URL divulgada no portal do eSocial e no Manual de Orientação do Desenvolvedor.

Os motivos de falhas HTTP podem ser encontrados em sites de pesquisa, veja esta URL, por exemplo: https://support.microsoft.com/pt-br/help/943891/the-http-status-code-in-iis-7-0--iis-7-5--and-iis-8-0. Além disso, é importante verificar a seção "7.9. Certificação digital" do Manual de Orientação do Desenvolvedor, disponível na área de Documentação Técnica. 

Link to comment
Share on other sites

Oliveiros:

nessa rotina de envio do e-social, não falta a linha onde define o certificado?

 

essa linha:

   oServer:setOption( 3, "CURRENT_USER\MY\" + ::cCertificado )

-------------------------------

  oServer:Open( "POST", cURL_Envio, .F. )

  oServer:SetRequestHeader( "SOAPAction", cSOAPAction )
  oServer:SetRequestHeader( "Content-Type", "text/xml; charset=utf-8" )
     

???
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...