Hi,

I am trying to use the keep alive property for axis 2 1.6.0. I require some
help related to this.
As per the documentation provide by the link
http://axis.apache.org/axis2/java/core/docs/http-transport.html#CommonsHTTPTransportSender
I have made the following changes.

client side axis2.xml => This seems to be default settings and I did not
change anything here.

================

    <transportSender name="https"

class="org.apache.axis2.transport.http.CommonsHTTPTransportSender">
        <parameter name="PROTOCOL">HTTP/1.1</parameter>
        <parameter name="Transfer-Encoding">chunked</parameter>
    </transportSender>



client side code

===========

 ......


        MultiThreadedHttpConnectionManager conmgr = new
MultiThreadedHttpConnectionManager();
        conmgr.getParams().setDefaultMaxConnectionsPerHost(10);
        HttpClient client = new HttpClient(conmgr);
        ctx.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);
  ....

            Options options = new Options();
            options.setTo(new EndpointReference("
https://localhost:8443/axis2/services/SecureWebService";));
            options.setProperty(RampartMessageData.KEY_RAMPART_POLICY,
loadPolicy("policy\\policy.xml"));
            options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true");
            options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, client);
            sc.setOptions(options);
.......
            for(int i=0;i <10; i++)
                {
                    Calendar startService = Calendar.getInstance();
                    int result = stub.subtract(a, b);
                    System.out.println(a + " - " + b + " = " + result);
                    Calendar end = Calendar.getInstance();
                    System.out.println("Stub's method exec time = " +
(end.getTimeInMillis() - startService.getTimeInMillis()) + " msec" );
                }

.....
I am able to see difference then the method is been executed the first time
and the subsequent hits.
Can anyone please confirm if the approach is correct. Also please let me
know if any setting is required in the server side.

Appreciate your help.

Thanks and regards,
Natanasabai.

Reply via email to