Re: HTTP/1.1 500 Internal Server Error
Actually, I made a mistake in my cutting and pasting, it really looks
like this:
----
try {
ByteArrayRequestEntity request = new
ByteArrayRequestEntity(audioBytes);
serverPost.setRequestEntity(request);
serverPost.setContentChunked(true);
try {
httpClient.executeMethod(serverPost);
if (serverPost.getStatusCode() ==
HttpStatus.SC_OK) {
testText.setText(serverPost.getResponseBodyAsString());
System.out.println("success: " +
serverPost.getResponseBodyAsString());
} else {
//testText.setText("Unexpected failure: "
+
serverPost.getStatusLine().toString());
System.out.println("Unexpected
failure: " +
serverPost.getStatusLine().toString());
}
} finally {
serverPost.releaseConnection();
}
} catch (HttpException ex) {
System.out.println(ex.toString());
} catch (IOException ex) {
System.out.println(ex.toString());
}
----
The difference being the use of serverPost.setRequestEntity(request),
request being the ByteArrayRequestEntity. I've tried using the
setRequestBody method, but my IDE (eclipse) and some docs say it's
depreciated, and it doesn't seem to work any differently anyway. What
the hell am I doing wrong here?
create the HttpClient
create the PostMethod(url)
create RequestEntity
setRequestEntity of the PostMethod
execute PostMethod
release connection
Is there something I'm missing?
Thank you, please help!
Joshua