Speak, folks, I have serious problems running the SOAP request on e-social servers.
This is my code:
$pfx = file_get_contents($pfx);
$certificate = Certificate::readPfx($pfx, $pass);
$wsdl = 'https://webservices.producaorestrita.esocial.gov.br/servicos/empregador/enviarloteeventos/WsEnviarLoteEventos.svc?WSDL';
$arquivo_xml = file_get_contents(ROOT_APP_CONTROLLER."rh/esocial/teste.xml");
$action = 'EnviarLoteEventos';
$operation = '';
$parameters = [];
$namespaces = [];
$request = htmlentities($arquivo_xml, ENT_COMPAT, 'UTF-8');
$soapheader = null;
try {
$soap = new \NFePHP\Common\Soap\SoapCurl($certificate);
$response = $soap->send($wsdl, $operation, $action, SOAP_1_1, $parameters, $namespaces, $request, $soapheader);
print_r($response);
} catch (Exception $e) {
print_r($e->getMessage());
}
It gives me the following error in the return of try catch:
An error occurred while trying to communication via soap, [https://webservices.producaorestrita.esocial.gov.br/servicos/empregador/enviarloteeventos/WsEnviarLoteEventos.svc?WSDL]HTTP/1.1 100 Continue
HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml;charset=utf-8;action=EnviarLoteEventos' was not the expected type 'text/xml; charset=utf-8'.
Cache-Control: private
Server: Microsoft-IIS/8.5
Set-Cookie: ASP.NET_SessionId=kfr2yuodygwpey5lnoronfzi; path=/; HttpOnly
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 27 Apr 2018 12:15:18 GMT
Content-Length: 0
So I figured it would be just me to change the header of the request to text / xml; charset = utf-8 ', but when I change it, it gives me the following error:
An error occurred while trying to communication via soap, [https://webservices.producaorestrita.esocial.gov.br/servicos/empregador/enviarloteeventos/WsEnviarLoteEventos.svc?WSDL]HTTP/1.1 100 Continue
HTTP/1.1 400 Bad Request
Cache-Control: private
Server: Microsoft-IIS/8.5
Set-Cookie: ASP.NET_SessionId=k0ii5ocr23zuujcgcuw0xfl2; path=/; HttpOnly
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Fri, 27 Apr 2018 12:18:40 GMT
Content-Length: 0
I'm already 3 days pounding on it, if anyone knows how to solve it, please help me!