Sunday, October 10, 2010

[android-developers] http POST request problem

in the following code - i get an http response code
400 - BAD REQUEST.

if i comment out the post.setEntity() line - then it
works fine - response code 200.

of course i've got internet permission

params is a list of 1 entry - string2string mapping.

URI uri = new URI(urlPath);

HttpPost post = new HttpPost(uri);

UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params,
"UTF-8");

post.setEntity(entity); // if this line is commented out -
the post results in status 200 OK

DefaultHttpClient client = new DefaultHttpClient();

HttpResponse res = client.execute(post);

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate