vendredi 12 mai 2017

SOAPClient Error: Could not connect to host on PHP 7.0 and Laravel

I am having issues connecting to a WSDL via SOAPClient on my Laravel application in a server with PHP 7.0. I have tested the following code on my local server using PHP 5.6 and it works. Both are running Linux; my local server is running Kubuntu and the other server is running CentOS 7.

var $client;

function __construct(){
    ini_set('soap.wsdl_cache_enabled',WSDL_CACHE_NONE);
    ini_set('soap.wsdl_cache_ttl', 0);

    $this->client = new SoapClient(env('WSDL_SOLMAN02_TEST'),
        ['login'=>env('SOLMAN_US_TEST'),
         'password'=>env('SOLMAN_PSSWD_TEST'),
         'cache_wsdl' => WSDL_CACHE_NONE,
         'soap_version' => SOAP_1_1,
         'ssl_method' => 'SOAP_SSL_METHOD_SSLv3',
         'trace' => true,
         'exception' => false,
         'stream_context'=> stream_context_create(array(
            'ssl'=> array(
                    'verify_peer'=>false,
                    'verify_peer_name'=>false
                )
            ))
        ]
    );

}
public function updateTicket(Ticket $ticket){

    $incident = $this->createTicketObject($ticket);
    $params = get_object_vars($incident);

    return $this->client->wsdlFunc($params);
}

The funny thing is that when I print dd($this->client->__getFunctions()); the WSDL responds with an array of all the functions that you can call, but when I actually call upon any function, the error is displayed.

I have tried just about everything, from changing every parameter in the connection to changing the php.ini, but nothing has worked. I have downgraded the server to PHP 5.6 and it still doesn't work.

I have also tested WSDL on SOAPUI and it works.

The only difference I find between both environments is that the server with PHP 7.0 has https.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire