skip to Main Content

I have a script in php that connect to a SOAP webservice. The problem is that in PHP 7.4 it works great (Tested in 3 different PC’s with php 7.4), but when I try in a system with php 8.1 get this error:

SOAP-ERROR: Parsing WSDL: Couldn’t load from
‘https://myurl.wsdl’ : failed to
load external entity
"https://myurl.wsdl"

My script:

    <?php
$wsdl = "https://myurl.wsdl";

$context = stream_context_create(array('ssl' => array('verify_peer' => false,
                            'verify_peer_name' => false, 
                            'allow_self_signed' => true,
                            )
                    )
                );

$header = array('local_cert' => 'file.pem', 
                'exceptions' => 1, 
                'trace' => true, 
                'stream_context' => $context
               );

ini_set("soap.wsdl_cache_enabled", "0");

try {  
    $client = new SoapClient($wsdl, $header);  
    $result = $client->function();  
} 
catch(Exception $e) 
{ 
    $message = $e->getMessage(); 
    echo $message; 
    die();
}

var_dump($result);
?>

Any suggestion?

Thanks!

UPDATE 1:
I did more text and maybe the problem is in Openssl 3 in Ubuntu 22.04 but not sure, because I have other enviroment with Openssl 1.1.1f and not working on php 8.1 but yes on 7.4

Waiting for some help.

2

Answers


  1. Chosen as BEST ANSWER

    I solved downgrading the security level on OpenSSL.conf


  2. I had the same problem after updating to Ubuntu 22.04 LTS.

    I tried to access the site / document via Curl and it gave me a clue as the server is in DMZ it does not have access to internal DNS so after entring target site in /etc/hosts everything works as intended.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search