Note that there are some explanatory texts on larger screens.

plurals
  1. PONameValuePair how to send blanks
    primarykey
    data
    text
    <p>I have a requirement to send some values to a service via HTTP POST. One of the parameters that gets sent must contain blanks. It is the "Key" nvp. But the service always returs a unsuccessful message, as soon as I add a value it work. </p> <p>Now here is the catch, when the request is done to the same service via iphone device it works just fine when they send BLANKS, am I missing something in my request to allow blank values to be sent via NameVauePair?</p> <p>Here is my NaveValuePair's</p> <pre><code>List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(5); nameValuePairs.add(new BasicNameValuePair("id","1")); nameValuePairs.add(new BasicNameValuePair("uId",android_id)); nameValuePairs.add(new BasicNameValuePair("Key", " ")); // This value must be BLANKS nameValuePairs.add(new BasicNameValuePair("Rate","0")); nameValuePairs.add(new BasicNameValuePair("Notes", notes)); </code></pre> <p>Here is my POST request</p> <pre><code>HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(context.getResources() .getString(R.string.url_event_rating)); try { httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs, "utf-8")); // Execute HTTP Post Request HttpResponse response = httpclient.execute(httppost); String responseBody = EntityUtils.toString(response .getEntity()); } catch (ClientProtocolException e) { Log.d("ClientProtocolException", e.getMessage()); } catch (IOException e) { Log.d("IOException", e.getMessage()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload