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 Wed, 14 Nov 2007 14:31:06 GMT

On Tue, 2007-11-13 at 10:06 -0700, Pradeep Avadhani wrote:
> Thanks for the response.
> 
> While method.getResponseBodyAsString()  does return the XML in most cases
> (as shown below)
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <Envelope>
> ...
> </Envelope>
> 
> but in the cases where the failure occur method returns the following
> content
> -------------------------------------------------------------------------------------------------------------
> 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
> ------------------------------------------------------------------------------------------------------------
> 
> I would like to understand the root cause of the issue before going the
> upgrade route. Can weblogic be eliminated as a cause for this issue ?
> 
> Pradeep A

Pradeep,

Symptoms you have described seem to suggest a threading issue. Are you
calling HttpClient from multiple threads? Are you using it with a
thread-safe connection manager?  

Oleg

> 
> On 11/13/07, Oleg Kalnichevski <olegk@apache.org> wrote:
> 
> >
> > 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
> >
> >


---------------------------------------------------------------------
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