android 服务器响应,android

我有一个应用程序,从数据提交一些到本地服务器,因此服务器将发回一个JSON。 说{status:“success”}

它在我的2.3 SDK模拟器中运行应用程序时工作,但安装在Galaxy Tab(2.2 SDK)中,相同的响应是以html的形式。

I/RESPONSE( 8190): <?xml version="1.0" encoding="utf-8"?>

I/RESPONSE( 8190): /p>

I/RESPONSE( 8190): "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

417 Expectation Failed

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

Error 417 Expectation Failed

I/RESPONSE( 8190):

Expectation Failed

I/RESPONSE( 8190):

Guru Meditation:

I/RESPONSE( 8190):

XID: 1902486816

I/RESPONSE( 8190):


I/RESPONSE( 8190):

I/RESPONSE( 8190): Varnish cache server

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190): <?xml version="1.0" encoding="utf-8"?>

I/RESPONSE( 8190): /p>

I/RESPONSE( 8190): "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

417 Expectation Failed

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

Error 417 Expectation Failed

I/RESPONSE( 8190):

Expectation Failed

I/RESPONSE( 8190):

Guru Meditation:

I/RESPONSE( 8190):

XID: 1902486816

I/RESPONSE( 8190):


I/RESPONSE( 8190):

I/RESPONSE( 8190): Varnish cache server

I/RESPONSE( 8190):

I/RESPONSE( 8190):

I/RESPONSE( 8190):

W/System.err( 8190): org.json.JSONException: A JSONObject text must begin with '{' at character 2 of

W/System.err( 8190): <?xml version="1.0" encoding="utf-8"?>

W/System.err( 8190): /p>

W/System.err( 8190): "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

W/System.err( 8190):

W/System.err( 8190):

W/System.err( 8190):

417 Expectation Failed

W/System.err( 8190):

W/System.err( 8190):

W/System.err( 8190):

Error 417 Expectation Failed

W/System.err( 8190):

Expectation Failed

W/System.err( 8190):

Guru Meditation:

W/System.err( 8190):

XID: 1902486816

W/System.err( 8190):


W/System.err( 8190):

W/System.err( 8190): Varnish cache server

W/System.err( 8190):

W/System.err( 8190):

W/System.err( 8190):

编辑:请求发送: -

try {

HttpClient client = new DefaultHttpClient();

String postURL = GlobalCodes.getBaseurl();

HttpPost post = new HttpPost(postURL);

List params = new ArrayList();

params.add(new BasicNameValuePair("show",

"testpost"));

post.setEntity(new UrlEncodedFormEntity(params));

HttpResponse responsePOST = client.execute(post);

HttpEntity resEntity = responsePOST.getEntity();

String str2 = EntityUtils.toString(resEntity);

Log.i("RESPONSE", "

if (resEntity != null) {

Log.i("RESPONSE","**");

JSONObject jsonObj = new JSONObject(str2);

if (jsonObj.getString("status").equalsIgnoreCase("succuss")) {

.....

} else {

......

}

}

} catch (Exception e) {

e.printStackTrace();

}

任何人都可以告诉我哪里出错了?

快乐的编码..!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值