1.下载导入 ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.jar
2.请求数据,在子线程中进行
HttpTransportSE ht = new HttpTransportSE(url);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject request = new SoapObject(SERVICE_NAMESPACE, mathodName);
request.addProperty("USER", etName);
request.addProperty("ID", id);
envelope.bodyOut = request;
envelope.setOutputSoapObject(request);
ht.debug = true;// 可调式
try {
ht.call(soapAction, envelope);
SoapObject result = (SoapObject) envelope.getResponse();
// Log.e("TAG", "==result=="+result);
} catch (IOException e) {
e.printStackTrace();
} catch (XmlPullParserException e) {
e.printStackTrace();
}
3.注意参数不能为空。
空间名,方法名由服务器提供。
soapAction=空间名+方法名。