android调用java的webservices返回结果null

来源:互联网 发布:淘宝客服绩效考核表格 编辑:程序博客网 时间:2024/04/29 18:38
String code = "",soapAction=GlobalConts.URL_POST+methodname;
//GlobalConts.URL_POST:http://ws.syzs.newland.com/
//methodname=validateUserInfo

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);

SoapObject request = new SoapObject(GlobalConts.URL_POST, methodname);

try {
request.addProperty("UserId", uname);
request.addProperty("Id", uid);
request.addProperty("password", upwd);

// request.addProperty("filestrs", tag);

envelope.bodyOut = request;
envelope.dotNet = false;
envelope.encodingStyle = "UTF-8";
envelope.setOutputSoapObject(request);
} catch (Exception e1) {
// TODO Auto-generated catch block
Log.e("Error", "1");
}

try {
AndroidHttpTransport ht = new AndroidHttpTransport(GlobalConts.URl_File);
ht.debug = true;
ht.call(soapAction, envelope);

if (envelope.getResponse() != null) {
SoapObject result = (SoapObject) envelope.bodyIn;
// String name = result.getProperty(0).toString();
// Object detail = (Object) result.getProperty(0);
if (result != null) {
code = result.toString();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return code;



调用webservices结果ht.call(soapAction, envelope);返回空。调试了好多遍,不知道什么原因。测试平台android4.4+求大神帮忙。谢谢。
0 0
原创粉丝点击