Olá, preciso fazer uma conexão Basic authencitation porém está retornando um erro: Not acceptable segue o código que eu estou usando
DefaultHttpClient httpClient = new DefaultHttpClient();
ResponseHandler resonseHandler = new BasicResponseHandler();
HttpPost postMethod = new HttpPost(URL_SERVIDOR_TESTE);
postMethod.setHeader( "Content-Type", "application/xml");
String credentials = "USER" + ":" + "USER";
String authorizationString = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
postMethod.setHeader("Authorization", authorizationString);
String response = null;
try {
response = httpClient.execute(postMethod,resonseHandler);
Log.d("LOG", "RESPOSTA: "+ response);
} catch (Exception e) {
Log.d("LOG", "RESPOSTA: "+ e.getLocalizedMessage());
}
Será que alguém pode me ajudar?
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário