Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android-Magento- How to Get the Details of Multiple Products in Android using XML-RPC

How to get the details of Multiple products in a Single Call in Android using XMLRPC from Magento.I am able to get the list of products using the function catalog_product.list using XMLRPC.

Now, i have the SKU id's of all the products.I am able to get the media details of each product using the function product_media.list.

If suppose I have 10 products,i have to call 10 times product_media.list method for each product which takes long time.

So,how can I call the multiCall function of Magento in Android. Many tutorials in php for calling the multiCall function are posted but I am not able to imitate the same in Android.

So please help me if you have similar code snippet that can make me understand multiCall function(for Android) so that I can Advance further using that.
Thanks.


PHP code Example from Josua Marcel C 's Answer:


$session = $client->call('login', array('apiUser', 'apiKey'));
$client->call('call', array($session,'somestuff.method', array('arg1', 'arg2', 'arg3')));  
$client->call('call', array($session, 'somestuff.method', 'arg1'));   
$client->call('call', array($session, 'somestuff.method'));

$client->call('multiCall', 
               array($session,
                  array(
                      array('somestuff.method', 'arg1'),
                      array('somestuff.method', array('arg1', 'arg2')),
                      array('somestuff.method')
                   )
              )
            );  

I would like to imitate the above php code in Android that calls the multiCall() function of the Magento.


like image 236
Haresh Chaudhary Avatar asked Aug 09 '12 07:08

Haresh Chaudhary


1 Answers

After making long long Research, I got half-way Solution that calls the multiCall() method without any Error,but Still I don't know how to get the response of the Server in a variable and use it.

AnyOne who has knowledge of it can Edit my Answer, I will be thankful to him.

The Code that I have Used is :

Object[] skuid=new Object[product_list.size()];
Object calling[]=new Object[product_list.size()];

for(int m=0;m<product_list.size();m++)
{
    skuid[m]=new Object[]{product_list.get(m).getp_Sku()};
    calling[m]=new Object[]{"catalog_product_attribute_media.list",skuid[m]};   
}

try 
{
  client.callEx("multiCall",new Object[]{Utils.sessionId,calling});
}
catch (XMLRPCException e) 
{
    e.printStackTrace();
}  

AcknowledgeMents :

I have worked on the Answer posted by Iain.

like image 55
Haresh Chaudhary Avatar answered Sep 28 '22 02:09

Haresh Chaudhary