我无法使用PHP连接到Magento SOAP API v2.发生的错误是:
PHP致命错误:未捕获的SoapFault异常:[WSDL] SOAP-ERROR:解析WSDL:无法从' http://www.example.com/index.php/api/v2_soap/index/wsdl/1/ ' 加载:无法加载外部实体" http://www.example.com/index.php/api/v2_soap/index/wsdl/1/ "
看起来,正在加载WSDL,但它不包含外部SOAP文件.
PHP连接代码:
$client = new SoapClient('http://www.example.com/api/v2_soap?wsdl=1');
$session = $client->login('username', 'password');
Run Code Online (Sandbox Code Playgroud)
从v2_soap剪切?wsdl = 1文件:
<service name="MagentoService">
<port name="Mage_Api_Model_Server_V2_HandlerPort" binding="typens:Mage_Api_Model_Server_V2_HandlerBinding">
<soap:address location="http://www.example.com/index.php/api/v2_soap/index/"/>
</port>
</service>
Run Code Online (Sandbox Code Playgroud)
Magento版本是1.5.1.0.