You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Krunal Dhamelia <nk...@gmail.com> on 2009/06/06 07:25:08 UTC

HttpClient 3.1 with WebLogic 9.2 - Bad Request

Hi All,
I am using HttpClient3.1 under weblogic9.2 application server.
I am sending XML request over HTTP to destination and getting Bad Request
Http Response code 400 , when I deploy my application to weblogic 9.2.
However the same code same request works fine with Tomcat6.0 I really do not
understand why ?
here is the code which sends the request.............

post = new PostMethod(transactionVO.getUrlStr());

//transactionVO.getRequestStr() is where my XML request string is stored.
 entity = new InputStreamRequestEntity(new StringInputStream(
transactionVO.getRequestStr()), CONTENT_TYPE_VALUE);
post.setRequestEntity(entity);

HttpMethodParams methodparam = new HttpMethodParams();
methodparam.setContentCharset(UTF_8);

post.setParams(methodparam);
post.setRequestHeader(CONTENT_TYPE_KEY, CONTENT_TYPE_VALUE);

// Get HTTP client. I have created this factory from where I get single
instance of HttpClient and I m using multithreaded connection manager.
httpclient = HttpClientFactory.getInstance().getHttpClient();

long start = System.currentTimeMillis();
 // Execute request
int result = httpclient.executeMethod(post);

if (result == 200) {
is = post.getResponseBodyAsStream();
inputSource = new InputSource(is);
inputSource.setEncoding(post.getResponseCharSet());
SaxXsltTransformer.transform(transactionVO, inputSource);
} else {
// Do the Error Handling
is = post.getResponseBodyAsStream();
sw = new StringWriter();

CopyUtils.copy(is, sw, post.getResponseCharSet());

sw.flush();
String responseStr = sw.toString();
sw.close();

// Set the error string in to pass it to caller system.
transactionVO.setResponseStr(responseStr);

logger.error("ALERT: Error from Responder", new Exception(
responseStr));
}

Please let me know if this is an identified issue, or suggest some
workarround

Thanks in advance.

Krunal Dhamelia