【发布时间】:2013-09-07 06:49:57
【问题描述】:
在AsynckTask 中使用NameValuePair 提出请求但没有得到响应
try
{
HttpConnectionParams.setConnectionTimeout(params,TIMEOUT_MILLISEC);
HttpConnectionParams.setSoTimeout(params,TIMEOUT_MILLISEC);
System.out.println(operation);
post = new HttpPost(operation);
if(nvp != null)
{
String temp = "dgdfg";
post.setEntity(new UrlEncodedFormEntity(nvp));
}
response = client.execute(post);
entity = response.getEntity();
if(entity != null)
{
result = EntityUtils.toString(entity);
}
else
{
Log.d("Response Failed","Response from server is failed");
}
}catch(Exception ex)
{
ex.printStackTrace();
}
网址
String url = "http://www.xxx.com/service/xxx.asmx/xxxxMethodName";
请求参数如
{
UserDetails = {
DeviceName = "My Phone";
DeviceToken = 707fc5a77124dd1a485608e8e03d31b708a0359b852df38bb3cc856e28;
EmailAddress = "admin@xxx.com";
IsRemember = True;
Password = "admin@xxx.com";
};
}
在numvalues中需要喜欢
String mm = "{ UserDetails = {DeviceName=\"My Phone\"; DeviceToken = 707fc5a77124dd1a485608e8e03d31b708a0359b852df38bb3cc856e28;EmailAddress=\"admin@xxx.com\";IsRemember = True; Password = \"admin@xxx.com\"; };}";
但没有到这里我得到 [...]
【问题讨论】:
-
Ankit 永远不要在 SO 上使用实际的 Web 服务。顺便说一句,Web 服务仅适用于应用程序,如果有人找到您的实际 WS URL,那将是有风险的。