Magento Soap API 1.9 - 无法加载外部实体

时间:2022-10-10 12:39:23

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

当我试图连接到Soap Api时,我收到此错误:

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

SOAP-ERROR:解析WSDL:无法从'https://www.lignedublanc.fr/index.php/api/soap/?wsdl'加载:无法加载外部实体“https://www.lignedublanc.fr /index.php/api/soap/?wsdl

i tried with soap UI and same errors.

我尝试使用肥皂UI和相同的错误。

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 个解决方案

#1


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:

我认为问题是由服务器无法从本地计算机访问API引起的。它实际上是阻止除开发机器之外的任何主机的.htaccess文件。因此,它会导致403 Forbidden错误,这实际上是SOAP错误。有关更多参考,请查看:

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

由于“无法加载外部实体”,无法连接到Magento SOAP API v2

#1


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:

我认为问题是由服务器无法从本地计算机访问API引起的。它实际上是阻止除开发机器之外的任何主机的.htaccess文件。因此,它会导致403 Forbidden错误,这实际上是SOAP错误。有关更多参考,请查看:

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

由于“无法加载外部实体”,无法连接到Magento SOAP API v2