Saturday, 27 December 2014

android exception at receiving proper response from xmlrpc call from android to magento



I have successfully connected the my android app to magento server via xmlrpc api. Also I have successfully retrieved the 'catalogcategory.tree' using the xmlrpc api . Now I want to retrieve the product images from their 'product ids' , hence following is the code I have written in 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()));


Following is exception



//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)


Following is the corresponding SOAPV1 code which runs OK on server



$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);


I have cross checked the input product ids , they are all valid and exist on my magento server


No comments:

Post a Comment