SOAP communication works in PHP5.6.26 but does not work in PHP7.0.13.
I started a project using php 5.6.26 and managed to communicate with the e-frete server via SOAP without problems.
This week I decided to update php to version 7.0.13, and communication via SOAP stopped working. I made several modifications based on examples on the internet, but nothing had any effect.
The code down, works 100% in php 5.6.26 but not in php 7.0.13:
$obterOperacaoTransportePdf = [
'ObterOperacaoTransportePdfRequest' => [
'Integrador' => 'xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx', //Hash de referência ao integrador
'Versao' => '1', //Versão = 1
'CodigoIdentificacaoOperacao' => 'xxxxxxxxxx/aaaa', //Código de identificação da Operação (CIOT).
'DocumentoViagem' => ''
]
];
$options = array(
'local_cert' => $this->certKEY,
'soap_version' => SOAP_1_2,
'cache_wsdl' => WSDL_CACHE_NONE,
"style" => SOAP_RPC,
'connection_timeout' => 15,
'encoding' => 'UTF-8',
'trace' => 1,
'exceptions' => 1
);
$urlWsdl = 'https://sistema.efrete.com:6061/Services/PefService.asmx?wsdl';
$soap = new \SoapClient($urlWsdl, $options);
$data = $soap->ObterOperacaoTransportePdf($obterOperacaoTransportePdf);
I have debugged the function "__doRequest" and value of the variable "$request" is: (Below, php 5.6.26 - correct and functional.)
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schemas.ipc.adm.br/efrete/objects" xmlns:ns2="http://schemas.ipc.adm.br/efrete/pef/objects" xmlns:ns3="http://schemas.ipc.adm.br/efrete/pef">
<env:Body>
<ns3:ObterOperacaoTransportePdf>
<ns2:ObterOperacaoTransportePdfRequest>
<ns1:Integrador>xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx</ns1:Integrador>
<ns1:Versao>1</ns1:Versao>
<ns2:CodigoIdentificacaoOperacao>xxxxxxxxxx/aaaa</ns2:CodigoIdentificacaoOperacao>
</ns2:ObterOperacaoTransportePdfRequest>
</ns3:ObterOperacaoTransportePdf>
</env:Body>
</env:Envelope>
The value of the "$ request" variable of php 7.0.13 is: (Is not correct.)
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schemas.ipc.adm.br/efrete/pef/objects" xmlns:ns2="http://schemas.ipc.adm.br/efrete/pef">
<env:Body>
<ns2:ObterOperacaoTransportePdf>
<ns1:ObterOperacaoTransportePdfRequest/>
</ns2:ObterOperacaoTransportePdf>
</env:Body>
</env:Envelope>
Anyone know a way to workaround this PHP7 issue?
Thank you very much!