cancel
Showing results for 
Search instead for 
Did you mean: 

API cart_product.add throwing XmlRpcException: SQLSTATE[21000]: Cardinality violation: 1241

API cart_product.add throwing XmlRpcException: SQLSTATE[21000]: Cardinality violation: 1241

I'm trying to add item to the cart. I' using Xml-Rpc and Java to call magento API.

 

"cart_product.add" is the api method to add product to cart. Documentation can be found here.

 

I have create cart and got quoteID using "cart.create" api call. 

 

Here is the code I'm using to add product to the cart.

 

        Map<String, String> item = new HashMap<String, String>();
        item.put("product_id", "902");
        item.put("quantity", 3);

        Object[] arryProductsObj = new Object[1];
        arryProductsObj[0] = item;
       
       // from previous call to cart.create()
	String cartId = cart.createCart();  		
        Object params = new Object[]{cartId, arryProductsObj};

        // from previous call to "login" with userName and userKey
        String sessionToken = getSessionToken();	
        Object[] callParams = new Object[]{sessionToken, "cart_product.add", new Object[]{params}};	
        Object result = (Boolean) client.getClient().execute("call", callParams);
        

 

Here is the error message Java XML-RPC library is throwing.

 

org.apache.xmlrpc.XmlRpcException: SQLSTATE[21000]: Cardinality violation: 1241 Operand should contain 1 column(s), query was: SELECT `sales_flat_quote`.* FROM `sales_flat_quote` WHERE (`sales_flat_quote`.`entity_id`=762, '905', 1)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143)
at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69)
at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137)
at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126)
at com.billeo.zipthr.processor.magento.MagentoCart.addProductToCart(MagentoCart.java:101)

 

I'm not quite sure why I'm receiving this error. Am I sending the params wrong to xml-prc call. Is there mismatch between the arguments sent using Java from PHP.

 

Any one has experience similar error before? And how can I solve this problem?

 

Regards,

--Anil