Note that there are some explanatory texts on larger screens.

plurals
  1. POPost request to server android
    primarykey
    data
    text
    <p>I need to send parameter email, password, country using the request below. it is not httpclient based and i don't find an example where i can post a request.</p> <pre><code>Request URL: http://.../services/rs/registration Request Method:PUT Status Code:200 OK Request Headers Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip,deflate,sdch Accept-Language:en-GB,en;q=0.8,en-US;q=0.6,fr;q=0.4 Connection:keep-alive Content-Length:155 Content-Type:application/json Cookie:i18next=fr Host:application.cloudapp.net Origin:http://application.cloudapp.net Referer:http://application.cloudapp.net/application/registration.xhtml User-Agent:Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.57 Safari/537.36 X-Requested-With:XMLHttpRequest </code></pre> <p>this is my working </p> <p>*</p> <pre><code>public static void httput(){ URL url; try { url = new URL(Constant.URL_AUTHENTIFICATION); //--This code works for updating a record from the feed-- HttpPut httpPut = new HttpPut(url.toString()); JSONStringer json = new JSONStringer() .object() .key("j_username").value("reefcube@cloudapp.com").key("j_password").value("test12345") .endObject(); StringEntity entity = new StringEntity(json.toString()); entity.setContentType("application/json;charset=UTF-8");//text/plain;charset=UTF-8 entity.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE,"application/json;charset=UTF-8")); httpPut.setEntity(entity); // Send request to WCF service DefaultHttpClient httpClient = new DefaultHttpClient(); HttpResponse response = httpClient.execute(httpPut); HttpEntity entity1 = response.getEntity(); if(entity1 != null&amp;&amp;(response.getStatusLine().getStatusCode()==201||response.getStatusLine().getStatusCode()==200)) { //--just so that you can view the response, this is optional-- int sc = response.getStatusLine().getStatusCode(); String sl = response.getStatusLine().getReasonPhrase(); System.out.println("response 200 "+sl); } else { int sc = response.getStatusLine().getStatusCode(); String sl = response.getStatusLine().getReasonPhrase(); System.out.println("response "+sl); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre> <p>*</p>
    singulars
    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.
    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