我有一个带有 CentOS 6、Apache 2.2、PHP 5.4 的云服务器,并且我有一个带有 Magento 的站点。我尝试使用 Magento WebService 并返回此错误:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://******.com/dev/index.php/api/soap/index/?wsdl=1' : failed to load external entity "http://******.com/dev/index.php/api/soap/index/?wsdl=1"
我在这里和谷歌搜索,我在 php.ini 中尝试了许多更改,但在所有情况下我都没有成功。
我在某些情况下读到这是服务器端的问题,因为配置错误。
注意¹:SOAP 安装在服务器中,在 phpinfo() 中启用了 SOAP。
注意²:在另一台服务器上正常工作。
任何人都知道如何解决这个问题?
编辑:服务器使用 WHM/CPanel,我使用 EasyApache 安装 Apache、PHP。并使用默认配置。
Edit2:这只是一个简单的示例代码,它使用了 SOAP 和它返回的错误:
代码:(这段代码的第一行是第9行,第13行是“$cli = new SoapClient($api_url_v1);”)
<?php
$api_url_v1 = "http://site.com/dev/api/soap/?wsdl=1";
$username = '*********';
$password = '*********';
$cli = new SoapClient($api_url_v1);
//retreive session id from login
$session_id = $cli->login($username, $password);
//call customer.list method
$result = $cli->call($session_id, 'customer.list', array(array()));
?>
错误:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://site.com/dev/api/soap/?wsdl=1' : failed to load external entity "http://site.com/dev/api/soap/?wsdl=1" in /home/******/public_html/test_soap.php:13 Stack trace: #0 /home/******/public_html/test_soap.php(13): SoapClient->SoapClient('http://site...') #1 {main} thrown in /home/******/public_html/test_soap.php on line 13