我想使用android中的ksoap2库在soap web Service中发送密钥对值。
喜欢:
Map<String,String> map = new Map<String,String>();
map.put(key,value);
map.put(key,value);
Vector<Object> vector = new Vector<Object>();
vector.add(10);
vector.add(map);
现在这个向量发送 ksoap2 库然后它给出序列化错误。 如果是另一种在 ksoap2 库中发送此地图的方式。
答案 0 :(得分:0)
我得到了解决方案......
Hashtable hashtable = new Hashtable();
hashtable.put("is_report", false);
hashtable.put("r_how", 1);
_client.addProperty("params",hashtable);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.bodyOut = _client;
HttpTransportSE _ht = new HttpTransportSE("drebedengi.ru/soap/");
_ht.debug = true;
(new MarshalHashtable()).register(_envelope);
答案 1 :(得分:0)
如果您使用Ksoap2:您也可以这样做....
//creating object of soap with parameter name
SoapObject param = new SoapObject(NAMESPACE,"shoppingCartProductEntity");
param.addProperty("product_id","886");
param.addProperty("sku","ABC 456-Black-10");
/* creating array of the product details
SoapObject EntityArray = new SoapObject(NAMESPACE, "shoppingCartProductEntityArray");
EntityArray.addProperty("products",param); */
//normal soap call
SoapObject request = new SoapObject(NAMESPACE,"shoppingCartProductAdd");
request.addProperty("sessionId", sessionId);
request.addProperty("quoteId", cartId);
request.addProperty("products",param (or) EntityArray); //adding array to cart
env.setOutputSoapObject(request);
androidHttpTransport.call(NAMESPACE +"/shoppingCartProductAdd ", env);
resultSoap = env.getResponse();
Log.d("****result****", resultSoap.toString());