android - SoapFault - 故障代码 : '1062' faultstring: 'Shipping method is not available'

标签 android soap ksoap2 magento-1.9 android-ksoap2

你好,我正在开发一个使用 Magento 作为后端的 Android 应用程序,我正在使用 magento 的 SOAP webervice,我已经将所有产品、客户和客户地址信息添加到购物车,但是当我尝试添加运输方式时到购物车,我收到这个错误


SoapFault - 错误代码:'1062' 错误字符串:'送货方式不可用'

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

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;承运人=工时; 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>

如您所见,有属性方法。实际上,我们必须添加运输方式... 所以你必须改变你的代码如下......

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 - 故障代码 : '1062' faultstring: 'Shipping method is not available' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33340649/

相关文章:

android - 如何动态更改 ListView 的分隔线高度?

php - 如何在 PHP 中验证非 wsdl soap

android - KSOAP: "org.ksoap2.serialization.SoapPrimitive"异常问题

android - 如何修复错误 (1, -2147483648)

android - 如何在 Android 中进行图像处理?

xml - 在 go 中解码特定的 SOAP 响应

java - ksoap2 序列化错误

android - ksoap2 类型转换 getResponse()

java - 如何从 NDK(JNI) 调用特定的 Java 方法?

xml - SOAP RPC/编码转换为 RPC/文字