当我尝试连接到Soap Api时,我收到此错误:
SOAP-ERROR:解析WSDL:无法从' https://www.lignedublanc.fr/index.php/api/soap/?wsdl'加载:无法加载外部实体" https://www.lignedublanc.fr/index.php/api/soap/?wsdl
我尝试使用soap UI和相同的错误。
我在网上尝试了一切,但没有任何帮助。
也许有人可以帮助我?
<?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";
}
答案 0 :(得分:0)
我认为问题是由服务器无法从本地计算机访问API引起的。它实际上是阻止除开发机器之外的任何主机的.htaccess文件。因此,它会导致403 Forbidden错误,这实际上是SOAP错误。如需更多参考,请查看:
Unable to connect to Magento SOAP API v2 due to "failed to load external entity"