HTTPResponse
Hope somebody can help me...
I got the HTTP response and able to retrieve the corresponding headers, but the problem is the response comes with message body which is in xml format... can someone help me provide the necessary code for to retrieve the message body...
thanks...
heres my code...
DefaultHttpClient client = new DefaultHttpClient();
HttpGet httpget = new HttpGet(responseURL);
Credentials defaultcreds = new UsernamePasswordCredentials(USERNAME, PASSWORD);
client.getCredentialsProvider().setCredentials(new AuthScope(DEVSERVER, PORT, REALM), defaultcreds);
System.out.println("Retrieving... ");
try {
HttpResponse convertedResponse = client.execute(httpget);
System.out.println("Connection: " + convertedResponse.getHeaders("Connection")[0].getValue().trim());
System.out.println("Date: " + convertedResponse.getHeaders("Date")[0].getValue().trim());
System.out.println("Content-type: " + convertedResponse.getHeaders("Content-type")[0].getValue().trim());
System.out.println("Content-Length: " + convertedResponse.getHeaders("Content-Length")[0].getValue().trim());
} catch (Exception ex) {
ex.printStackTrace(pw);
}