Hello i am developing an Android app which uses Magento as the backend and i am using SOAP webervice of magento, I have added all the product , customer and customer address information to the cart , But when i try to add the shipping method to the cart , I am getting this error
This is the code i am trying with , Please help me to resolve this
SoapObject availableShippingMethods = new SoapObject(MAGENTO_NAMESPACE, "shoppingCartShippingList");
availableShippingMethods.addProperty("sessionId", sessionId);
availableShippingMethods.addProperty("quoteId", quoteId);
env.setOutputSoapObject(availableShippingMethods);
androidHttpTransport.call("", env);
Object resultForAvailableShippingMethods = env.getResponse();
Log.d("AvailableShippingMethods",resultForAvailableShippingMethods.toString());
This will give us this output
below is the code which sets Shipping method to the CartId
SoapObject shippingmethod = new SoapObject(MAGENTO_NAMESPACE, "shoppingCartShippingMethod");
shippingmethod.addProperty("sessionId", sessionId);
shippingmethod.addProperty("quoteId", quoteId);
shippingmethod.addProperty("shippingMethod", "flatrate_error");//Code for Flatrate shipping method and it is enabled in magento site
env.setOutputSoapObject(shippingmethod);
androidHttpTransport.call("", env);
Log.d("shippingMethod", shippingmethod.toString());
Object resultforShippingMethod = env.getResponse();
Log.d("ShippingMethod", resultforShippingMethod.toString());
I know it is too late to answer... but it may help someone in future...
The problem is in the documentation of magento soap v2... When I have gone through the wsdl link, I have noticed somthing as below...
<message name="shoppingCartShippingMethodRequest">
<part name="sessionId" type="xsd:string"/>
<part name="quoteId" type="xsd:int"/>
<part name="method" type="xsd:string"/>
<part name="storeId" type="xsd:string"/>
</message>
As u can see, there's property method. Actually, there we have to add the shipping method... So u have to change ur code as below...
SoapObject shippingmethod = new SoapObject(MAGENTO_NAMESPACE,"shoppingCartShippingMethod");
shippingmethod.addProperty("sessionId", sessionId);
shippingmethod.addProperty("quoteId", quoteId);
shippingmethod.addProperty("method", "flatrate_error");
env.setOutputSoapObject(shippingmethod);
androidHttpTransport.call("", env);
Log.d("shippingMethod", shippingmethod.toString());
Object resultforShippingMethod = env.getResponse();
Log.d("ShippingMethod", resultforShippingMethod.toString());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With