On Wed, 2006-12-13 at 16:31 +0800, jim ma wrote:
> Oleg,
> 
> Thank you for your quick reply.
> 
> You can use following steps to reproduce this issue:

...

>  When I set the buffer size is 1024*1 ,  readed count will be : 
> ---count -----32
> ---count -----1024
> ---count -----638
> 
> buffersize is 1024*2 , The output is :
> ---count -----27
> ---count -----1667
> 
> buffersize is 1024*3 ,output will be :
> ---count -----32
> ---count -----1662
> 
>  Regards
> 
> Jim
> 

Hi Jim,

The problem is perfectly reproducible. However, at this point I do not
see any evidence of this being a problem with HttpCore. 

When submitting an identical request using Commons HttpClient instead of
HttpUrlConnection this is what I get:

---count -----1694

[DEBUG] header - >> "POST /axis2/services/Axis2SampleDocLitService
HTTP/1.1[\r][\n]"
[DEBUG] header - >> "User-Agent: Jakarta
Commons-HttpClient/3.1-beta1[\r][\n]"
[DEBUG] header - >> "Host: localhost:8080[\r][\n]"
[DEBUG] header - >> "Content-Length: 1676[\r][\n]"
[DEBUG] header - >> "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[DEBUG] header - >> "[\r][\n]"
[DEBUG] content - >> "<?xml version='1.0'
encoding='UTF-8'?><soapenv:Envelope 
...
[DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
[DEBUG] header - << "Date: Wed, 13 Dec 2006 13:20:35 GMT[\r][\n]"
[DEBUG] header - << "Server: Simple-Server/1.1[\r][\n]"
[DEBUG] header - << "Transfer-Encoding: chunked[\r][\n]"
[DEBUG] header - << "Content-Type: text/xml; charset=UTF-8[\r][\n]"
[DEBUG] content - << "6"
[DEBUG] content - << "9"
[DEBUG] content - << "e"
[DEBUG] content - << "[\r]"
[DEBUG] content - << "[\n]"
[DEBUG] content - << "<?xml version='1.0'
encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header 
/><soapenv:Body><echoStringResponse 
xmlns="http://userguide.axis2.apache.org/Axis2SampleDocLit";><echoStringReturn 
...
[DEBUG] content - << "[\r]"
[DEBUG] content - << "[\n]"
[DEBUG] content - << "0"
[DEBUG] content - << "[\r]"
[DEBUG] content - << "[\n]"
[DEBUG] content - << "[\r]"
[DEBUG] content - << "[\n]"

As you you can see from the wire log HttpCore correctly generates only
one chunk of content and HttpClient reads it as one chunk. I am not of a
very high opinion about HttpURLConnection in general and in this
particular instance tend to think this problem is likely to be
HttpURLConnection's fault.

Is there anything I may be missing?

Oleg
----

test code
===============
HttpClient httpclient = new HttpClient();

byte[] buffer = new byte[1024*5];

String outstr = "<?xml version='1.0' encoding='UTF-8'?>"
    + "<soapenv:Envelope xmlns:soapenv=
\"http://schemas.xmlsoap.org/soap/envelope/\";><soapenv:Header 
/><soapenv:Body><echoString 
xmlns=\"http://userguide.axis2.apache.org/Axis2SampleDocLit\";><echoStringParam 
xmlns=\"http://userguide.axis2.apache.org/xsd\";>ECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRINGECHOSTRING</echoStringParam></echoString></soapenv:Body></soapenv:Envelope>";
 

PostMethod httppost = new
PostMethod("http://localhost:8080/axis2/services/Axis2SampleDocLitService";);
RequestEntity requestEntity = new StringRequestEntity(outstr,
"text/xml", "UTF-8");
httppost.setRequestEntity(requestEntity);
try {
    httpclient.executeMethod(httppost);
    
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    InputStream in = httppost.getResponseBodyAsStream();
    int count;
    while ((count = in.read(buffer)) > 0) {
        System.out.println("---count -----" + count);
        out.write(buffer, 0, count);
    }
} finally {
    httppost.releaseConnection();
}
==============


> 
> 
> On 12/12/06, Oleg Kalnichevski <[EMAIL PROTECTED]> wrote:
>         On Tue, 2006-12-12 at 11:55 +0800, jim ma wrote:
>         >
>         > Can anyone shed some light on this ?
>         >
>         
>         Jim,
>         
>         HttpCore uses 2048 byte chunks per default and as far as I
>         know Axis2
>         SimpleHttpServer does not override this default behavior. 
>         
>         
> http://jakarta.apache.org/httpcomponents/httpcore/jakarta-httpcore/xref/org/apache/http/io/ChunkedOutputStream.html#132
>         
>         I simply do not see a way for HttpCore to produce content
>         chunks less
>         then 2048.
>         
>         Please give me a little more details how to reproduce the
>         problem
>         locally.
>         
>         Oleg
>         
>         
>         > On 12/8/06, jim ma < [EMAIL PROTECTED]> wrote:
>         >         Hi all ,
>         >
>         >         I think this is a bug maybe introduced by 
>         >         jakarta-httpcore-4.0-alpha2.  When enable the chunk
>         mode for 
>         >         StringEntity , client will read 28 bytes each time .
>         Client
>         >         will read many times when a large payload response
>         returned .
>         >         This definitely affects Aixs2's performance.
>         > 
>         >         Axis2 need to set chunk buffersize for HttpCore
>         before
>         >         invoking StringEntity.setChunk(true) ?
>         >
>         >         Regards
>         >
>         >         Jim
>         >
>         >
>         >         On 12/5/06, jim ma < [EMAIL PROTECTED]> wrote:
>         >                 Hi all ,
>         >
>         >                 I downloaded the aixs2 1.1 std kit and tried
>         a simple
>         >                 sample contains one operation:
>         echoString() . After I 
>         >                 deployed the service in repository and
>         launch the
>         >                 server with axis2server.I wrote the
>         following code to
>         >                 send the payload to aixs2server and soap
>         response : 
>         >
>         >                 httpCon.getOutputStream().write(payload);
>         >                 httpCon.getOutputStream().flush();
>         >                 byte[] buffer = new byte[1024];
>         >                 count =
>         httpCon.getInputStream().read(buffer);
>         >                 while (count > 0) {
>         >                        System.out.println ("---readed----" +
>         count);
>         >                        count = httpCon.getInputStream
>         ().read(buffer);
>         >                 }
>         >
>         >                 I found the thing confused me : each time it
>         only can
>         >                 read 28 bytes from inputStream . Large size
>         respsone
>         >                 will be readed many times.  But I deployed
>         it into 
>         >                 tomcat , It will read 1024 bytes each time.
>         >
>         >                 Which line code in Artix2 1.1 cause this ?
>         >
>         >                 Thanks
>         >
>         >                 Jim
>         >
>         >
>         >
>         >
>         >
>         >
>         >
>         
>         
>         ---------------------------------------------------------------------
>         To unsubscribe, e-mail: [EMAIL PROTECTED]
>         For additional commands, e-mail: [EMAIL PROTECTED]
>         
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to