By default axis use HTTP/1.0 for calling webservices.
The following code
for i in 1..10:
  axis.method("doit")
creates 10 connection to the server:
# netstat -tuap |egrep -ic 'http.*clienthost.*ESTAB'
10
We can configure axis to use just one connection setting:
- HTTP/1.1
- transfer encoding:Â chunked
this involves
- configuring axis client.wsdd to use Commons-Httpclient-3.0 for transport
- enabling pre-emptive authentication
Use CommonsHTTPClient
# find $TOMCAT/ -name axis\*.jar
# unzip axis-1.4.jar org/apache/axis/client/client-config.wsdd
# vi org/apache/axis/client/client-config.wsdd
change HTTPSender with the apache commons one and repack file:
- <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/> + <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender"/>
# zip -f zip axis-1.4.jar org/apache/axis/client/client-config.wsdd
Now with wireshark/ethereal/netstat you’ll see that while running you got:
# netstat -tuap |egrep -ic 'http.*clienthost.*ESTAB'
1 Setting PreEmptive authentication
Sniffing, you’ll notice one issue: client won’t automatically send authentication data. Instead it
- client send an unauth soap request
- server returns 401 (Authentication Required)
- client send the authenticated request
- server says ok
To force CommonsHTTPClient to send authentication data, we need to set the following property:
      System.setProperty("httpclient.authentication.preemptive", "true");
And the magic is done: jjust one connection for all the call…and your WebService Producer say thankyou!