Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SoapFault - faultcode: '1062' faultstring: 'Shipping method is not available'

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


SoapFault - faultcode: '1062' faultstring: 'Shipping method is not available'

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


D/AvailableShippingMethods﹕ shoppingCartShippingMethodEntityArray{item=shoppingCartShippingMethodEntity{code=flatrate_error; carrier=flatrate; carrier_title=Flat Rate; price=0; }; }

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());
like image 354
Sudhir Belagali Avatar asked Oct 26 '15 07:10

Sudhir Belagali


1 Answers

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());
like image 196
Rishad Appat Avatar answered Oct 03 '22 13:10

Rishad Appat