上面是WebService网页调出来的column1的数据是4
上面是用toast出来的数据column的数据是0
这究竟是为什么
上面是XML格式,下面是JSON格式。你可以检查下你传入的请求的参数是否有差别。
传入的参数就是个用户名
@恋水剑: 我是想知道你的服务器是根据参数还是HTTP HEADERS中的标记来决定是返回XML,还是返回JSON格式?
传入的参数就是个用户名
String methodName2 = "NoteCount";
// 创建HttpTransportSE传输对象
HttpTransportSE ht2 = new HttpTransportSE(SERVICE_URL);
ht2.debug = true;
// 使用SOAP1.1协议创建Envelop对象
SoapSerializationEnvelope envelope2 = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
// 实例化SoapObject对象
SoapObject soapObject2 = new SoapObject(SERVICE_NS, methodName2);
soapObject2.addProperty("Uname", "wang");
// 将soapObject对象设置为 SoapSerializationEnvelope对象的传出SOAP消息
envelope2.bodyOut = soapObject;
envelope2.dotNet = true;
try {
ht2.call(SERVICE_NS + methodName2, envelope2);
if (envelope2.getResponse()!=null) {
SoapObject num_result = (SoapObject)envelope2.bodyIn;
SoapObject detail1 = (SoapObject) num_result.getProperty(0);
SoapObject detail2 = (SoapObject) detail1.getProperty(1);
SoapObject detail3 = (SoapObject) detail2.getProperty(0);
SoapObject detail4 = (SoapObject) detail3.getProperty(0);
String result = detail4.toString();
result = result.split("=")[1];
result = result.split(";")[0];
Toast toast = Toast.makeText(MainActivity.this, result, Toast.LENGTH_LONG);
toast.show();
@恋水剑: 请你用Fiddler或别的工具抓包,把响应的内容贴出来。
请检查HTTP头里面的Content-Type
dataset类型的