duanchongchu5177 2011-06-10 14:47 采纳率: 0%
浏览 239

Magento API调用获取产品信息

I used the below code to get products details from a magento store from my localhost

$proxy = new SoapClient('http://domain.com/magento/index.php/api/soap/?wsdl');

$sessionId = $proxy->login('username', 'apikey');
$filters = array(
    'sku' => array('like'=>'test%')
);

$products = $proxy->call($sessionId, 'product.list', array($filters));

var_dump($products);

It works on my localhost machine but not on server. But soap configuration is enabled in server. Below is the error message

" SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in "

I got corresponding xml file when I used the below URL http://domainname/shoponline/index.php/api/soap/?wsdl

I removed index.php but didn't get any result.

$proxy = new SoapClient('http://domain.com/magento/index.php/api/soap/?wsdl');

The above statement display the below error

Parsing WSDL: Couldn't find definitions in
  • 写回答

4条回答 默认 最新

  • dongxin1980 2011-08-03 12:02
    关注

    Looks like the WSDL XML file was not loaded at all. To debug, try to open this file in your browser. I guess it will not be loaded at all and you'll get an error (which will help you to find out what's wrong) or you will be asked to input username and password (basic HTTP auth). In the second case try change your URL from http://domain.com/magento/index.php/api/soap/?wsdl to http://user:pass@domain.com/magento/index.php/api/soap/?wsdl

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog