Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you can send the data as Json packets to the device and in device parse the json packets and access the data. your calls to webservice should be a http call eg this is for the client.</p> <p>http:\server\metnod\get_somedata?name=something</p> <p>and the server should query the database for this parameter and send you the reponse as Json. parse json and get your details.</p> <pre><code>String url = "http:\\example.com\mycontroller\get_employee?id=2" HttpPost httpPostRequest = new HttpPost(url); StringEntity se; se = new StringEntity(jsonObjSend.toString()); httpPostRequest.setEntity(se); httpPostRequest.setHeader("Authorization", usercredential); httpPostRequest.setHeader("Accept", "application/json"); httpPostRequest.setHeader("Content-type", "application/json"); long t = System.currentTimeMillis(); response = (HttpResponse) httpclient.execute(httpPostRequest); Log.i(TAG, "HTTPResponse received in [" + (System.currentTimeMillis()-t) + "ms]"); HttpEntity entity = response.getEntity(); if (entity != null) { InputStream instream = entity.getContent(); Header contentEncoding = response.getFirstHeader("Content-Encoding"); if (contentEncoding != null &amp;&amp; contentEncoding.getValue().equalsIgnoreCase("gzip")) { instream = new GZIPInputStream(instream); } // convert content stream to a String String resultString= convertStreamToString(instream); Log.v(null, "resultString "+resultString); instream.close(); // Transform the String into a JSONObject if(resultString!=null){ jsonObjRecv = new JSONObject(resultString); } // Raw DEBUG output of our received JSON object: Log.i(TAG,"&lt;jsonobject&gt;\n"+jsonObjRecv.toString()+"\n&lt;/jsonobject&gt;"); return jsonObjRecv; </code></pre> <p>In the server side you should have a get_employee method in a controller called mycontroller. in the method you can process the request as a normal http request and send the response as json eg</p> <pre><code>employee = Employee.find_by_id(params[:id]) @js_response = ActiveSupport::JSON.encode(employee) respond_to do |format| format.json { render :json =&gt; @js_response} format.html end </code></pre> <p>for CRUD you need to create different methods with appropriate parameters like delete_employee, update_employee etc. refer json.org to create/parse json in android</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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