I was looking information about how I can send information using HttpPost method on android, and I always see this:
HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(posturl); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("Name","Var1")); params.add(new BasicNameValuePair("Name2","Var2")); httppost.setEntity(new UrlEncodedFormEntity(params)); HttpResponse resp = httpclient.execute(httppost); HttpEntity ent = resp.getEntity(); The problem is that I cant do that, because I have to connect to a resource that receive a String with XML format.
Any idea about how can I send only the String without using a List<nameValuePair>
POSTbody yourself.POSTrelate to theJavaScriptsnippet. You can request data in JavaScript, but can you receive a POST directy? I don't think so. This means that the server receives it before and passes it gets passed to the JavaScript through request variables, In this case, you're wasting your time with Praful's approach.