how to call a web service using REST in Android in your moodle?
<p>10.0.2.2</p>

<pre><code>public void CallService1() {
    try {
        String url = "http://&lt;My domain&gt;/webservice/rest/server.php";//&lt;My domain&gt; = 10.0.2.2
        HttpClient httpClient = new DefaultHttpClient();
        HttpPost httpPost = new HttpPost(url);
        httpPost.setHeader("Accept", "application/json");


        HttpParams para = new BasicHttpParams();
        para.setParameter("wstoken", "19f26759dbb144879fb19f20d6ac6ac4");
        para.setParameter("wsfunction", "moodle_user_get_users_by_id");
        para.setParameter("userids[0]", 2);
        httpPost.setParams(para);

        HttpResponse response = httpClient.execute(httpPost);

        if (response.getStatusLine().getStatusCode() != 200) {
            throw new RuntimeException("Failed : HTTP error code : "
                    + response.getStatusLine().getStatusCode());
        }
        BufferedReader in = new BufferedReader(new InputStreamReader(
                (response.getEntity().getContent())));

        String output;
        String a = "";
        while ((output = in.readLine()) != null) {
            a += output;
        }

        txtKetQua.setText(a);

        httpClient.getConnectionManager().shutdown();

    } catch (Exception ex) {

    }
}
</code></pre>

<p>Response</p>

<pre><code>Incorrect access detected, this server may be accessed only through "http:/localhost" address, sorry.Please notify server administrator.

This page should automatically redirect. If nothing is happening please use the continue link below.
</code></pre>

<p>I would really appreciate if you could help me with this</p>

<p>thanks :D                                                                      </p>
