hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pradeep Avadhani" <pav...@gmail.com>
Subject getResponseBodyAsString() returns chunked HTTP content instead of resolved repsonse
Date Mon, 12 Nov 2007 18:53:08 GMT

Java client application that has been in production for 2 years is running
into an issue now. Client application uses commons-httpclient.jar (version
2.0.2) to communicate with weblogic 8.1 hosted J2EE app. All of a sudden, at
random failures are occuring while processing the HTTP response. This
behavior is sporadic and unfortunately not reproducible in the same or
different environment. Meaning, if the transaction that leads to the issue
is rerun, it works fine. The details of the issue are below.

As part of the code below
//create a method object
method = *new* PostMethod(*this*.config.getURL());
method.setRequestHeader("Content-type", "text/xml");
*if* (headers != *null*) {
*   for* (*int* i = 0; headers.size() > i; i++) {
      Header header = (Header)headers.get(i);

StringRequestEntity entity = *new* StringRequestEntity(request);

//execute the method
String result = method.getResponseBodyAsString();

method.getResponseBodyAsString() occasionally returns HTTP content instead
of the expected XML response

HTTP/1.1 200 OK
Date: Tue, 06 Nov 2007 12:41:46 GMT
Content-Type: text/xml; charset="UTF-8"
Transfer-Encoding: chunked

<?xml version="1.0" encoding="UTF-8"?>
The response XML sizes vary between ~2kb to ~50Kb. Can anyone
provide insight into this odd behavior? Thanks

Pradeep A

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message