我假设您了解Web服务。
使用.net写一个Web服务然后使用ksoap库你会得到响应。
然后根据您的要求格式化响应。
代码供参考:
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL ="http://localhost/Web_Service.asmx?";// you can use IP address instead of localhost
private static final String METHOD_NAME = "Function_Name";
private static final String SOAP_ACTION = NAMESPACE+METHOD_NAME;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("parm_name",prm_value);// Parameter for Method
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);//call the eb service Method
} catch (Exception e) {
e.printStackTrace();}//Next task is to get Response and format that response
SoapObject obj,obj1,obj2,obj3;
obj= (SoapObject) envelope.getResponse();
obj1=(SoapObject) obj.getProperty("diffgram");
obj2=(SoapObject) obj1.getProperty("NewDataSet");
for(int i=0;i
{
obj3=(SoapObject) obj2.getProperty(i);
obj3.getProperty(0).toString();//value of column 1
obj3.getProperty(1).toString();//value of column 2
//like that you will get value from each column
}Link for Ksoap library for Android
您可以从上面的链接下载库。
我知道这会解决你的问题。
如果您有任何问题,请添加评论。