我的android app中需要发送webservice ,于是我使用了 ksop2 进行发送,在测试过程中不是很顺利,不能正常工作.
我的web service 请求格式如下
创新互联是工信部颁发资质IDC服务器商,为用户提供优质的眉山联通机房服务
[html] view plaincopy
我在android 代码中使用 ksoap2 如下
[java] view plaincopy
SoapObject request = new SoapObject("Namespace", "methodname");
request.addProperty(properyObject);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//SOAP is implemented in dotNet true/false.
envelope.dotNet = true;
MarshalDouble md = new MarshalDouble();
//envelope.implicitTypes = true;
envelope.implicitTypes = true;
md.register(envelope);
//Set request data into envelope and send request using HttpTransport
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(mInObj.getUrl(), networkTimeOut);
androidHttpTransport.debug= true;
androidHttpTransport.call(SoapAction, envelope,headerPropertyArrayList);
ksop2 处理请求后变成这样
[html] view plaincopy
&
求救:
看看官方的 ksoap2 文档
https://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks#sending/receiving_array_of_complex_types_or_primitives
你可以创建一个实现marshable接口的类,并在类中添加其他属性
原文地址:http://www.itmmd.com/201412/296.html
该文章由 萌萌的IT人 整理发布,转载须标明出处。