Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – SoapFault – faultcode:’1062’faultstring:’运送方式不可用’大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
您好,我正在开发一个使用Magento作为后端的 @L_403_0@应用程序,而我正在使用magento的SOAP webervice,我已将所有的产品,客户和客户地址信息添加到购物车中,但是当我尝试将运送方式添加到购物车我收到这个错误

SoapFault – faultcode:’1062’faultstring:’运送方式不可用’

这是我正在尝试的代码,请帮我解决这个问题

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());

这将给我们这个输出

D / AvailableShippingMethods:shoppingCartShippingMethodEntityArray {item = shoppingCartShippingMethodEntity {code = flatrate_error;载体= flatrate; carrier_title =统一费率;价= 0; }; }

以下是将Shipping方法设置为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());

解决方法

我知道答案已经太迟了,但可能会帮助未来的人…

问题在于magento soap v2的文档…当我通过wsdl链接时,我注意到一些如下所示:

<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>

你可以看到,有属性方法.其实我们必须添加运送方式…
所以你必须更改ur代码如下…

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());

大佬总结

以上是大佬教程为你收集整理的android – SoapFault – faultcode:’1062’faultstring:’运送方式不可用’全部内容,希望文章能够帮你解决android – SoapFault – faultcode:’1062’faultstring:’运送方式不可用’所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: