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.
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();
}
I have worked on the Answer posted by Iain
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With