I am very new to Android rest web-services I want connect Rest web-services from my android program for that I write the following code :
HttpClient httpClient = new DefaultHttpClient();
HttpContext localContext = new BasicHttpContext();
HttpGet httpGet = new HttpGet("http://***********:8000/sap/bc/srt/rfc/sap/z_customer_lookup1/800/z_customer_lookup1/z_customer_lookup1_bind&sap-user=*******&sap-password=********");
but when I am running this code I am getting the logon Error message how can i provide authentication in Android Rest Web-services.
try this code for using http post method :
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(3);
nameValuePairs.add(new BasicNameValuePair("request", "login"));
nameValuePairs.add(new BasicNameValuePair("user_name", user_name));
nameValuePairs.add(new BasicNameValuePair("password", pass));
DefaultHttpClient client = new DefaultHttpClient();
HttpPost httppost = new HttpPost(url);
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));