Sasi Reddy

Sasi Reddy

  • NA
  • 346
  • 225.8k

How to call WebAPI from android app?

Feb 5 2015 12:23 AM
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)