我如何在异步任务中进行ksoap2调用?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了我如何在异步任务中进行ksoap2调用?相关的知识,希望对你有一定的参考价值。
我是android开发的新手。我正在尝试开发一个将与.net webservice连接以便检索数据的应用程序。我想用AsyncTask
进行ksoap2调用。我如何用asynctask命名为asyncronus?
我的SoapCall类是
public class SoapCall {
public final static String SOAP_ACTION = "http://www.alpha.net.com/ExecuteEBSCommand";
public final static String OPERATION_NAME = "ExecuteEBSCommand";
public final static String NAMESPACE = "http://www.alpha.net.com";
public final static String URL = "http://192.168.2.100/Ebs2Alpha/Service.asmx";
public String connection(String Command, String CommandParameters) throws Throwable, Throwable {
String response = null;
SoapObject Request = new SoapObject(NAMESPACE, OPERATION_NAME);
Request.addProperty("strCommand", Command);
Request.addProperty("strCommandParameters", CommandParameters);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
// Needed to make the internet call
// Allow for debugging - needed to output the request
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
// this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) soapEnvelope.bodyIn;
response = result.getProperty(0).toString();
return response;
}
}
到目前为止,我通过在主活动中使用以下方法调用连接方法来获得响应:>
SoapCall call1= new SoapCall();
call1.connection("get_clients", "%");
我是android开发的新手。我正在尝试开发一个将与.net webservice连接以便检索数据的应用程序。我想使用AsyncTask进行ksoap2调用。如何...
答案
None另一答案
None以上是关于我如何在异步任务中进行ksoap2调用?的主要内容,如果未能解决你的问题,请参考以下文章
我应该在 Fragment 中的啥生命周期状态下执行异步任务?