0

when i tried to connect to Soap Api, i'm getting this error :

SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://www.lignedublanc.fr/index.php/api/soap/?wsdl' : failed to load external entity "https://www.lignedublanc.fr/index.php/api/soap/?wsdl

i tried with soap UI and same errors.

i tried everything on the net but nothing helped.

Maybe someone here can help me ?

    <?php
ini_set('soap.wsdl_cache_enabled',0);
ini_set('soap.wsdl_cache_ttl',0);

$url = 'https://www.lignedublanc.fr/index.php/api/soap/?wsdl=1';

$MagentoAPILogin = '';
$MagentoAPIPass = '';

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

try {
    echo "Connecting to : $url\n";

    //$client = new SoapClient($url);
    $client = new SoapClient($url, ['stream_context' => $context]);

    echo $client->login($MagentoAPILogin, $MagentoAPIPass)."\n";
    echo 'Login successful';
} catch (Exception $e) {
    echo 'Login fail'."\n";
    echo $e->getMessage()."\n";
    echo $e->getTraceAsString()."\n";
}
  • 1
    Please add to the question the code that is causing this error. – gioele Apr 12 '18 at 13:11
  • hi, you can simply access to this url :$context = stream_context_create([ 'ssl' => [ 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ] ]); try { echo "Connecting to : $url\n"; $client = new SoapClient($url, ['stream_context' => $context]); echo $client->login($MagentoAPILogin, $MagentoAPIPass)."\n"; echo 'Login successful'; } catch (Exception $e) { echo 'Login fail'."\n"; echo $e->getMessage()."\n"; echo $e->getTraceAsString()."\n"; } – jordan elbaz Apr 16 '18 at 13:14
  • anyone can help me on this forum ? – jordan elbaz May 03 '18 at 10:33

1 Answers1

0

I believe the problem is caused by the server not being able to access the API from the local machine. It is actually the .htaccess file that blocking any hosts except the development machines. Hence, it results in a 403 Forbidden error which is actually the SOAP error. For more reference, have a look:

Unable to connect to Magento SOAP API v2 due to "failed to load external entity"