【问题标题】:Soap Product List Output - Magento肥皂产品列表输出 - Magento
【发布时间】:2013-05-06 07:46:45
【问题描述】:

我尝试使用 Magento API 文档通过 SOAP 时间输出我的产品列表,整个事情看起来像这样: (http://www.magentocommerce.com/api/soap/introduction.html)

<?php
//include the Magento API file - replace with your server path to the file
require_once('/absolut-dirl/app/Mage.php');

/***** Configuration ******/
$myAPILogin = 'login';
$myAPIKey = 'key';


// Begin SOAP Requests
$client = new SoapClient('https://shop-url.com/index.php/api/soap/?wsdl');
$session = $client->login($myAPILogin, $myAPIKey);

//get all my database products into an array
$products = $client->call($session, 'catalog_product.list');

echo "Starting product loop...<br/><br/>";
var_dump($products);
?>

但是,我总是得到 NULL 结果。我究竟做错了什么? 关于快速帮助,我将不胜感激。

问候 罗利

//对不起我的英语不好。

【问题讨论】:

  • 这真的是您使用的 URL(“shop-url.com”),可能是从文档中复制和粘贴的,还是经过净化的 URL,以便在此处隐藏真实域?跨度>
  • 我隐藏了真实域名

标签: php api magento soap


【解决方案1】:

这可能是登录凭据的问题。使用 try catch 块并检查。

try
{
    $proxy  = new SoapClient($magento_webserver."api/soap/?wsdl");
    $sessionId  = $proxy->login($magento_webservices_username,  $magento_webservices_passwd);
    echo "Soap login complete! <br/>";
    echo "======================== <br/>";
}
catch (SoapFault $fault)
{
    die("\n\n SOAP Fault: (fault code: {$fault->faultcode},
    fault string: {$fault->faultstring}) <br/>");
}

【讨论】:

    【解决方案2】:

    我添加了 try-catch 块并得到以下结果:

    Soap Login complete!
    ========================
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-18
      • 2020-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-27
      • 1970-01-01
      • 2012-12-30
      相关资源
      最近更新 更多