如何从使用ksoap的webservice获取数组中的每个值 [英] how do I get each value from array , from webservice using ksoap
本文介绍了如何从使用ksoap的webservice获取数组中的每个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我能够获得单个文本响应但无法获得数组响应
来自.asmx webservice的XML响应
I am able to get a single text response but can't get an array response
XML response from .asmx webservice
<?xml version="1.0" encoding="UTF-8"?>
-<ArrayOfString xmlns="http://tempuri.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<string>RE</string>
<string>Wazir Muhammad</string>
<string>Logistics</string>
<string>AlReem Water Purification</string>
<string>1234567890</string>
<string>3000</string>
<string>Dummy</string>
</ArrayOfString>
Android Side Code
Android Side Code
private class getUser extends AsyncTask<String,Void,String>
{
String result;
TextView tv=(TextView) findViewById(R.id.tvEName);
@Override
protected String doInBackground(String... params)
{
//String value = params[0].toString();
SoapObject Request=new SoapObject(NAMESPACE,METHOD_NAME);
Request.addProperty("value","RE");
SoapSerializationEnvelope soapEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet=true;
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport aht=new AndroidHttpTransport(URL);
try{
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject resultString=(SoapObject)soapEnvelope.getResponse();
result=resultString.toString();
}
catch (Exception ex){
result=ex.toString();
}
return result;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
tv.setText(result);
}
}
我从android中的ksoap得到的回复是
anyType {string = RE;
string = Wazir Muhammad;
string = Logistics;
string = AlReem水净化;
string = 1234567890;
string = 3000;
string = abc;}
The response which I get from ksoap in android is
anyType{string=RE;
string=Wazir Muhammad;
string=Logistics;
string=AlReem Water Purification;
string=1234567890;
string=3000;
string=abc;}
推荐答案
检查:
KSoap2 Android接收对象数组 [ ^ ]
如何检索值使用Ksoap2 webservice [ ^ ]
如何从Web服务获取java android中的数组使用ksoap [ ^ ]
Check:
KSoap2 Android Receive Array of Objects[^]
How to retrieve values using Ksoap2 webservice[^]
how to get array in java android from web service with ksoap[^]
这篇关于如何从使用ksoap的webservice获取数组中的每个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文