• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps httppost error 403.

Hello:

I have a Web Service developed in Java with Spring. From my browser and from the Android Emulator browser I can get to it fine.

However, my Android App gets http error 403 while accessing the same WS.

Below is my code, the System.out.println prints the error code 403. In the same Android Emulator, the browser receives the JSON object fine.

Thanks a lot for the help.

protected String doInBackground(String... urls){

String u = urls[0];
HttpClient httpclient = new DefaultHttpClient();
StringBuilder builder = new StringBuilder();
HttpPost httppost = new HttpPost(u);
System.out.println("URL: " + u);
try {
HttpResponse respuesta = httpclient.execute(httppost);
StatusLine statusLine = respuesta.getStatusLine();
int statusCode = statusLine.getStatusCode();
System.out.println("Status : " + statusCode);
if (statusCode == 200){
HttpEntity entity = respuesta.getEntity();
InputStream contenido = entity.getContent();
..............................................
 
Back
Top Bottom