1
Answer

How to call WebAPI from android app?

Sasi Reddy

Sasi Reddy

9y
11.4k
1
I have android app,here i am passing two parameters to webapi.I also have webapi which is taking that two parameters and it is running on localhost.
How to call that webapi from android app?.. 

  DefaultHttpClient httpClient = new DefaultHttpClient();
                HttpPost httpPost = new HttpPost("http://localhost:23941/api/Default1/Create");
                HttpHost proxy = new HttpHost("192.168.1.16", 8080);
                httpclient.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
                httpPost.setEntity(new UrlEncodedFormEntity(args));
                httpPost.setHeader("Content-type", "application/json");
                HttpResponse response = httpClient.execute(httpPost);


Like above i am calling webapi but it is not hitting the webapi(kept breakpoint in webapi).
                
                
                
                
                
                
               

Answers (1)