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

3

10

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());
Jurgen answered 26/10, 2015 at 7:36 Comment(4)
u can test your web service using soupUI toolLanceted
Check your webservice method name and passed method name both are same or notFabi
I have retrieved the list of available shipping methods and I gave the exact shipping method name , But still i am not gettingJurgen
did u solved this issue? plz let m know how...Rathe
R
2

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());
Rathe answered 8/2, 2016 at 11:13 Comment(1)
,sir your answer is valuable regardless of the time ,thanks for the answer , +10 for answerJurgen
I
0

It might be because of wrong country ID. After entering correct information I am getting two shipping methods (freeshipping_freeshipping and flatrate_flatrate).

Impair answered 10/11, 2015 at 19:45 Comment(1)
but we are not entering any country Id hereJurgen
I
0

Before setting shipping method you need to set customer addresses first & in customer addresses you need to enter country id.

Impair answered 11/11, 2015 at 14:26 Comment(8)
yes i have done this ,, I have entered "IN" for India ..But still getting the same error ,Jurgen
Then please check if you have entered address id or not? Previously I used to get code as "flatrate_error" but now I am getting 2 shipping methods i.e. one is freeshipping_freeshipping & and another as flatrate_flatrate.same I am getting in front end too.Impair
I am using SOAP V2 version , But it is throwing some fault code error while adding customer address info to the cartJurgen
what error code you are getting while adding customer address info to the cart?Impair
I have added customer address info to the cart except address_idJurgen
what kind of configuration u kept for shipping methods in magento admin panelJurgen
address_id is compulsory and you can fetch it by calling "customerAddressList" method. For testing purpose we kept flat rate and free shipping methods in magento admin panel so we are getting two shipping method when calling "shoppingCartShippingList" method!Impair
btw i am still getting 1062 error after correctly setting customer address so in case you get the output after setting customer address then let me know!Impair

© 2022 - 2024 — McMap. All rights reserved.