0

我的情况非常糟糕,我从 sudzc 网站上获得了 ObjectiveC 课程。使用“http://www.xxx.in/mstore/api/soap/?wsdl”

在“SDZMagentoServiceExample.m”类中,我得到一种方法

[服务调用:self action:@selector(callHandler:) sessionId:@"" resourcePath:@"catalog_category.level" args: (id)args];

如果我在 args 中传递字典或数组,它总是会给我参数错误,例如“请求的网站代码无效:”。

请帮助我,我的情况非常糟糕。

提前致谢。

4

2 回答 2

0

我将无法在 Objective C 代码中为您提供帮助,但我可以向您展示一些关于 PHP 的知识。您可以尝试这种类型的调用:-

$proxy = new SoapClient('http://www.iphone5case.in/mstore/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');

/**
 * As defined in the "Manage Stores" section of Admin panel,
 * where you need to use the specific Website Code and/or Store Code
 */
$websiteCode = null;
$storeCode = 'german';

// Parent Category ID
$parentCategoryId = 2;

$firstLevel = $proxy->call($sessionId, 'category.level', array($websiteCode, $storeCode, $parentCategoryId));

现在,如果您打印此变量“ $firstLevel”,您将从此 Web 服务 API 获得所需的输出。

此外,每当您使用 Magento SOAP API v1 时,每个参数都需要作为数组元素。在这种情况下,以下是此 API 调用“ category.level”所需的主要参数:-

  1. 网站代码或 ID
  2. 商店查看代码或 ID
  3. 父类别 ID

因此,您需要创建一个数组,并将上述每个参数按顺序放置为数组元素,例如:-

array(
    $websiteCode,
    $storeCode,
    $parentCategoryId
)

最后,请确保您始终参考这篇文章,因为您可以在这里获得几乎所有 Web Service API 方法的用法。

希望能帮助到你。

于 2012-03-20T11:13:07.490 回答
0

/**
 * Catalog category api
 *
 * @category   Mage
 * @package    Mage_Catalog
 * @author     Magento Core Team <core@magentocommerce.com>
 */
class Mage_Catalog_Model_Category_Api extends Mage_Catalog_Model_Api_Resource
{

以下代码:

/**
 * Retrieve level of categories for category/store view/website
 *
 * @param string|int|null $website
 * @param string|int|null $store
 * @param int|null $categoryId
 * @return array
 */
public function level($website = null, $store = null, $categoryId = null)
{

因此,数组和字典都不会被接受。只有原始字符串或 int 值。

于 2012-03-20T10:07:57.820 回答