Skip to content Skip to sidebar Skip to footer

Httppost In Android Not Working

I am trying to connect to apache tomcat server using HTTP POST, when i see LOG file of server it showing GET /login/validate_doc.jsp HTTP/1.1' 200 685 , which means it is getting

Solution 1:

Try specifying encoding when constructing UrlEncodedFormEntity. By default it is ISO-8859-1. Also this will make your code future safe

Creating a UrlEncodedFormEntity from a List of NameValuePairs throws a NullPointerException

Solution 2:

Given that you are using a post, then you probably are sending data on your request body, Am I right?, then you have to specify the content-type of the data you are sending in the headers, in order to execute a proper post:). For example if I am sending a json in the request body then I should add a header like this:

request.addHeader("content-type", "text/json");

Cheers

Post a Comment for "Httppost In Android Not Working"