【问题标题】:magento product not exist response from an xmlrpc api in androidandroid中xmlrpc api的magento产品不存在响应
【发布时间】:2015-02-24 07:05:48
【问题描述】:

我已通过 xmlrpc api 成功地将我的 android 应用程序连接到 magento 服务器。我还使用 xmlrpc api 成功检索了“catalogcategory.tree”。现在我想从他们的 'product ids' 中检索产品图片,因此以下是我在 android 中编写的代码

    Map map = new HashMap();
        map.put("product_id", 12446);
        map.put("product_id", 12445);
        Object[] productdetails1=new Object [] {map};
        Object medialist = null;
        Object param1[]=new Object[]{productdetails1};
        Object param[]=new Object[]{CS_CONSTANTS.session_id,"catalog_product_attribute_media.list",param1};
        try {
        medialist=client.callEx("call", param);
       Log.i("Out Put of Adding", medialist.toString());
    } catch (Exception e) {
       e.printStackTrace();

    } 
    Log.e("HERE","is array : " + String.valueOf(medialist.getClass().isArray())+"\n"
    +"class    : " + medialist.getClass().toString()+"\n"
    +"hashCode : " + String.valueOf(medialist.hashCode()));

以下是异常

 //12-27 15:11:04.936: W/System.err(22977): com.cs.xmlrpc.libraries.XMLRPCFault: XMLRPC Fault: Product not exists. [code 101]
 //12-27 15:11:04.936: W/System.err(22977): at com.cs.xmlrpc.libraries.XMLRPCClient.callEx(XMLRPCClient.java:226)

以下是在服务器上运行正常的相应 SOAPV1 代码

$client = new SoapClient('http://magentohost/api/soap/?wsdl');
$session = $client->login('apiUser', 'apiKey');
$result = $client->call($session, 'catalog_product_attribute_media.list', '12446');
var_dump($result);

我已经交叉检查了输入的产品 ID,它们都是有效的并且存在于我的 magento 服务器上

【问题讨论】:

    标签: android xml magento rpc


    【解决方案1】:

    试试这个...它对我有用:

    String product_id="325";
    
    Object[] array= (Object[]) client.callEx("call",new Object[] session_id,"product_media.list",new Object[]{product_id}});
    
    for (Object s:array) {
        hashMap1=(HashMap)s;
    
        Log.i("ImageURL:",hashMap1.get("url").toString());
        //[types, exclude, position, url, label, file]
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-25
      • 1970-01-01
      相关资源
      最近更新 更多