0
나는 android ksoap2와 magento soap api V2를 사용하여 쇼핑 카트를 만들고 있습니다. 고객이 장바구니 제품을 api shoppingCartProductMoveToCustomerQuote를 사용하여 장바구니로 옮길 수 없습니다. 고객의 견적 existed'.I 아니다 '나는 오류를 얻고 사용 나는 아래의 코드를 사용할 수있는 linkMagento : 제품을 고객의 카트로 옮깁니다.
:
private String response,id;
String[][] Products = new String[][] {{"20","20","1"}};
protected String doInBackground(String... params)
{
try
{
//SoapEnvelop.VER11 is SOAP Version 1.1 constant
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.xsd = SoapSerializationEnvelope.XSD;
envelope.enc = SoapSerializationEnvelope.ENC;
SoapObject request = new SoapObject(NAMESPACE,"login");
request.addProperty("username", "***");
request.addProperty("apiKey", "*********");
//envelope.bodyOut = request;
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(URL);
try
{
transport.debug=true;
transport.call(NAMESPACE + SOAP_ACTION_PREFIX + "shoppingCartProductAdd", envelope);
// transport.call(NAMESPACE + SOAP_ACTION_PREFIX + "catalogProductList", envelope);
response=(String) envelope.getResponse();
String sessionId = response.toString();
Log.d("The session Id is:",sessionId);
SoapObject SingleProduct = new SoapObject(NAMESPACE, "shoppingCartProductEntity");
PropertyInfo pi = new PropertyInfo();
pi.setName("product_id");
pi.setValue(Integer.parseInt(Products[0][0]));
pi.setType(Integer.class);
SingleProduct.addProperty(pi);
pi = new PropertyInfo();
pi.setName("sku");
pi.setValue(Products[0][1]);
pi.setType(String.class);
SingleProduct.addProperty(pi);
pi = new PropertyInfo();
pi.setName("qty");
pi.setValue(Products[0][2]);
pi.setType(Double.class);
SingleProduct.addProperty(pi);
SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray");
EntityArray.addProperty("products",SingleProduct);
request = new SoapObject(NAMESPACE,METHOD_NAME);
//adding the propery such as sessionId and Customerdata for request
request.addProperty("sessionId",sessionId);
request.addProperty("quoteId",100);
request.addProperty("products",EntityArray);
request.addProperty("options",null);
request.addProperty("bundle_option",null);
request.addProperty("bundle_option_qty",null);
request.addProperty("links",null);
//request.addProperty("store_id", 1);
envelope.setOutputSoapObject(request);
transport.call(NAMESPACE + SOAP_ACTION_PREFIX + METHOD_NAME, envelope);
//getting the response which is the customerId
Log.d("Test", "request: " + transport.requestDump);
Log.d("Test", "response: " + transport.responseDump);
}
catch (IOException e)
{
e.printStackTrace();
}
catch (XmlPullParserException e)
{
e.printStackTrace();
}