HttpClient client = new HttpClient(connMgr);
client.setHostConfiguration(hostConfig);
PostMethod method = new PostMethod(tokenURL);
method.setQueryString( userModel.getQueryString() );
client.executeMethod(method);
byte[] responseBody = method.getResponseBody();
method.releaseConnection();
The response I get is : Request format is invalid: .
--------------
However, If I run the same query using the following code:
con.setRequestMethod("POST");
con.setDoOutput(true);
con.setDoInput(true);
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream());
writer.write( userModel.getQueryString() );
writer.flush();
writer.close();
InputStream resultStream = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(resultStream));
StringBuffer aResponse = new StringBuffer(); String aLine = reader.readLine();
while(aLine != null){
aResponse.append(aLine);
aLine = reader.readLine();
}
resultStream.close();
releaseConnection(con);
String retData = aResponse.toString();
I get the expected string as a response.
What I am doing wrong in using HttpClient? Any Idea?.
-Satya
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]