douquanzhan0315 2013-04-24 11:00
浏览 54

Magento api cart_coupon.add不起作用

I am creating Android app that allows user to add product into his shopping cart and places order. I am using XMLRPC for this purpose.

Following steps I have done

1.cart.create
2.cart_customer.set
3.cart_customer.addresses
4.cart_shipping.list
5.cart_shipping.method
6.cart_product.add
7.cart_payment.list
8.cart_payment.method

All code works fine till cart_payment.method , but when I call cart_coupon.add api I get exception

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {null}methodResponse
(position:START_TAG (empty) <br>@1:7 in java.io.InputStreamReader@4151b450) 
at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046)

My code is:

client = new XMLRPCClient(url);
object = client.callEx("call", new Object[]{sessionId,
                    "cart_coupon.add",new Object[]{shoppingCardId,couponcode}});

where url is valid magento host url,shoppingCardId is CardId that I get from server.

Exception is at class XMLRPCClient, at line

pullParser.require(XmlPullParser.START_TAG, null, Tag.METHOD_RESPONSE);

I think server replies with blank string and parser doesn't find start tag.

If I call same api through php script, cart_coupon.add and cart.order work fine and I get order id in response and at server side in sales->orders , I can see order has been placed successfully. But when I follow same procedure from Android I get Exception described above.
What should I do?

  • 写回答

1条回答 默认 最新

  • dsx58940 2013-05-20 06:52
    关注

    I also got same problem. I bypassed XMLRPC for last call and written php script to place order.

    评论

报告相同问题?

悬赏问题

  • ¥15 touchsocket udp组播
  • ¥20 MAC怎么安装Silverlight 插件?以及安装了怎么启用
  • ¥15 VS2012中查询语句无法填入解析,数值传不进去
  • ¥15 gis系统开发出现命名空间“ESRI.ArcGIS”中不存在类型或命名空间名“Analyst3D”报错
  • ¥15 怎么让ai定时给我发信息 c#或者python
  • ¥15 scrapy的Error
  • ¥15 RBF-VSG姚凤军论文复现问题
  • ¥30 开发一个APP商城在制作tabbar的时候运行不了代码没有检查出错误,但是显示不出tabbar,以下为运行结果,如何解决?
  • ¥15 多网卡服务器中winform如何绑定指定网卡
  • ¥15 关于#python#pandas#的问题,想要实现:多个TXT导入Excel,进行分列,不同txt之间都从第一行开始,请各位专家解答!