2012-03-20 36 views
0

我處於非常糟糕的情況,我從sudzc網站獲得了objectiveC類。 使用 「http://www.xxx.in/mstore/api/soap/?wsdl」Sudzc for Magento網絡服務

在 「SDZMagentoServiceExample.m」 類

我得到一個方法

[服務電話:自我行動:@選擇(callHandler :) sessionId:@「」resourcePath:@「catalog_category.level」args:(id)args];

它總是給我參數錯誤,如 「無效的網站代碼請求:」如果我傳遞字典或數組在args中。

請幫助我,我處於非常糟糕的情況。

在此先感謝。

+0

爲了獲得更好的結果,我將網頁Magento Web服務更新爲「WS-I合規性」。 但之後我開始得到以下錯誤,任何人有想法? SOAP-ENV: SOAP-ENV:服務器過程登錄不存在 objectivecdeveloper 2012-03-20 11:49:57

回答

0

/** 
* Catalog category api 
* 
* @category Mage 
* @package Mage_Catalog 
* @author  Magento Core Team <[email protected]> 
*/ 
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) 
{ 

所以也不陣列,也不字典將被接受。只有原始字符串或整數值。

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 
) 

最後,請確保始終引用this article,因爲您可以在此處使用幾乎所有Web Service API方法。

希望它有幫助。