Olá pessoal, estou tentando a diversos dias consumir webservice da NFe de minas gerais. O retorno que tenho é: Error Fetching http headers
O problema acontece em qualquer webservice da NFe, já no caso de NFCe funcionando todos os serviços webservice.
Veja meu código:
$client=new SoapClient(
'https://hnfe.fazenda.mg.gov.br/nfe2/services/NFeStatusServico4?WSDL',
array('encoding'=>'UTF-8',
'keep_alive'=>true,
'local_cert'=>$certificate,
'verifypeer' => false,
'verifyhost' => true,
'style' => SOAP_DOCUMENT,
'use' => SOAP_LITERAL,
'cache_wsdl'=>WSDL_CACHE_NONE,
'soap_version'=>SOAP_1_2,
'connection_timeout' => 180,
'compression' => 0,
'exceptions' => true,
'trace'=>true,
'stream_context'=> stream_context_create(
array('ssl'=> array(
'crypto_method' => STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
'ciphers' => 'SHA256',
'verify_peer'=>false,
'verify_peer_name'=>false,
'allow_self_signed' => true
)))));
$txtxml='<consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00"><tpAmb>2</tpAmb><cUF>31</cUF><xServ>STATUS</xServ></consStatServ>';
$nfeDadosMsg=array('any'=>$txtxml);
$nfeDadosMsg=array('nfeDadosMsg'=>$nfeDadosMsg);
$retorno=$client->__soapCall('nfeStatusServicoNF',$nfeDadosMsg);
Alguém já passou por problema assim ou semelhante ?
Quem puder ajudar, agradeço antecipadamente.
Obs: O Código acima, está funcionando em SP, RS, PR, GO. Meu problema é somente em MG
Mais detalhes...
Request:
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.portalfiscal.inf.br/nfe/wsdl/NFeStatusServico4"><env:Body><ns1:nfeDadosMsg><consStatServ xmlns="http://www.portalfiscal.inf.br/nfe" versao="4.00"><tpAmb>2</tpAmb><cUF>31</cUF><xServ>STATUS</xServ></consStatServ></ns1:nfeDadosMsg></env:Body></env:Envelope>
Função disponível no WebService:
echo("<pre>".htmlentities($client->__getLastRequest())."</pre><BR>");
array(1) { [0]=> string(68) "nFeStatusServico4Result nfeStatusServicoNF(nfeDadosMsg $nfeDadosMsg)" }
Retorno:
echo(utf8_encode(var_dump($retorno)));
string(27) "Error Fetching http headers"