2013-04-24 2 views
0

사용자가 장바구니에 제품을 추가하고 주문할 수있는 Android 앱을 만듭니다. 이 목적으로 XMLRPC를 사용하고 있습니다.Magento api cart_coupon.add가 작동하지 않습니다.

다음 단계 내가했던

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 

모든 코드가 cart_payment.method까지 잘 작동하지만 내가 cart_coupon.add API를 호출 할 때 예외를 얻을

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

내 코드는 다음과 같습니다

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

url은 유효한 magento 호스트 URL이고, shoppingCardId는 서버에서 가져온 CardId입니다.

예외 내가 서버는 태그를 시작 찾을 수없는 빈 문자열 파서로 응답 생각 라인

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

에서, 클래스 XMLRPCClient에 있습니다.

PHP 스크립트를 통해 동일한 API를 호출하면 cart_coupon.add 및 cart.order가 제대로 작동하고 응답으로 주문 ID를 얻고 서버 측에서 sales-> orders에서 주문이 성공적으로 완료되었음을 알 수 있습니다. 하지만 Android에서 동일한 절차를 수행하면 위에서 설명한 예외가 발생합니다.
어떻게해야합니까?

답변

0

나는 또한 같은 문제가있다. 마지막 호출을 위해 XMLRPC를 우회하고 PHP 스크립트를 작성하여 주문했습니다.

관련 문제