PHP7 SOAP problem

Asked

Viewed 629 times

0

I started a project using php 5.6.26 and managed to communicate with the e-mail 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 took effect.

The following code 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);

Return when used PHP7:

[ObterOperacaoTransportePdfResult] => stdClass Object
(
        [Versao] => 1
        [Sucesso] => 
        [Excecao] => stdClass Object
            (
                [Mensagem] => Sistema e-FRETE (www.efrete.com): [Negócio] (Protocolo: 86337) Erro obtendo PDF de operação de transporte: Integrador não cadastrado
            )
        [ProtocoloServico] => 86337
) 

In PHP5 returns the PDF normally.

In conversation with the e-freight people, according to them, the 'Integrator' is not coming, so I’m thinking it’s something that php7 is sending in the wrong way...

Does anyone have any suggestions to mount differently to test? or if you’ve been through something similar in php7 and solved...

Thank you very much!

  • Welcome to stackpt! You checked if there are differences between SOAP messages sent by PHP versions 5 and 7?

  • Hello, As far as I have checked is equal. I believe the problem should be within the extension "php_soap.dll"... Or, in the new version of php something has changed and you should add some more information....

  • Guys, I solved the problem by making the call differently: Instead of calling it like this: $data = $Soap->Get operacaotransportepdf($obtainOperacaoTransportePdf); I made the call like this: $dataResp = $Soap->__soapCall($operaration, array($data));

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.