hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: getResponseBodyAsString() returns chunked HTTP content instead of resolved repsonse
Date Tue, 13 Nov 2007 10:25:46 GMT

On Mon, 2007-11-12 at 11:53 -0700, Pradeep Avadhani wrote:
> Hi,
> 
> 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);
>       method.setRequestHeader(header);
>    }
> }
> 
> StringRequestEntity entity = *new* StringRequestEntity(request);
> method.setRequestEntity(entity);
> 
> //execute the method
> client.executeMethod(method);
> String result = method.getResponseBodyAsString();
> 
> method.getResponseBodyAsString() occasionally returns HTTP content instead
> of the expected XML response
> 

What exactly do you mean by "returns HTTP content"?

Anyways, please consider upgrading to HttpClient 3.1. Support for
HttpClient 2.0.2 has been discontinued quite a while ago.

Oleg 


> HTTP/1.1 200 OK
> Date: Tue, 06 Nov 2007 12:41:46 GMT
> Content-Type: text/xml; charset="UTF-8"
> Transfer-Encoding: chunked
> 
> 0fe6
> <?xml version="1.0" encoding="UTF-8"?>
> <Envelope>
> …
> </Envelope>
> 0000
> The response XML sizes vary between ~2kb to ~50Kb. Can anyone
> provide insight into this odd behavior? Thanks
> 
> Pradeep A


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Mime
View raw message