How Do I Post A Parameter To A Web Service From Android?
I can retrieve an xml file using HTTP post and response. However, now I need to post a String parameter as well as the URL. The following code is telling me that the HTTP staus cod
Solution 1:
500 is a server error, and nothing strikes me as obviously wrong with this code. Have you tested the server against a post request? Is the server expecting a string when you're giving it a name value pair?
You can try to test with Wfetch.
Solution 2:
To add POST parameters in yout HttpPost object, you will use a List of NameValuPair :
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
parameters.add(new BasicNameValuePair("name_param1", "value_param1"));
And to add this parameter to your HttpPost :
UrlEncodedFormEntityformEntity=newUrlEncodedFormEntity(parameters);
httpPost.setEntity(formEntity);
Post a Comment for "How Do I Post A Parameter To A Web Service From Android?"