You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Mike Charnoky <no...@nextbus.com> on 2005/06/01 00:09:44 UTC
http keepalive for axis clients?
Now that I fixed the SOAPAction bug in CommonsHTTPSender, I find that
the TCP socket used by my client is not actually reused. Every time I
try to reuse a SOAPConnection to make a SOAPConnection.call(), a new TCP
socket is established with the server. Is this correct behavior? Isn't
the socket supposed to be reused (to take advantage of http keepalive)?
I can see from tcpdump that the client is initiating the socket close,
it always sends the FIN first. Also, I see that the sockets are not
closed immediately. It looks like a bunch of sockets get closed at the
same time every 13 sec or so.
Again, I am using Axis 1.2 (final) with the Commons HTTPClient 3.0rc2.
I am using these libraries to create a SOAP client using the SAAJ API.
My client connects to a .net webservice. It must query for data several
times per minute, so I am trying to get HTTP/1.1 keepalive support working.
The client code basically works like this:
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection conn = factory.createConnection();
while(true) {
SOAPMessage request = generateMyMessage();
SOAPMessage response = soapConnection.call(request, url);
try { Thread.sleep(10000); } catch (Exception e) {}
}
noky
Re: http keepalive for axis clients?
Posted by Mike Charnoky <no...@nextbus.com>.
I dug around in the code a bit to get my answer. In case others need
help, here's the deal: org.apache.axis.soap.SOAPConnectionImpl creates a
new Call object every time SOAPConnection.call() is invoked. Thus, it
is impossible to reuse a socket connection and make use of http/1.1
keepalives.
I got around this problem by chucking my SAAJ client code and using
Axis's JAX-RPC DII interfaces instead. By creating my own Call object,
I found I could keep a socket open to the webserver I am polling.
noky
Mike Charnoky wrote:
> Now that I fixed the SOAPAction bug in CommonsHTTPSender, I find that
> the TCP socket used by my client is not actually reused. Every time I
> try to reuse a SOAPConnection to make a SOAPConnection.call(), a new TCP
> socket is established with the server. Is this correct behavior? Isn't
> the socket supposed to be reused (to take advantage of http keepalive)?
>
> I can see from tcpdump that the client is initiating the socket close,
> it always sends the FIN first. Also, I see that the sockets are not
> closed immediately. It looks like a bunch of sockets get closed at the
> same time every 13 sec or so.
>
> Again, I am using Axis 1.2 (final) with the Commons HTTPClient 3.0rc2.
> I am using these libraries to create a SOAP client using the SAAJ API.
> My client connects to a .net webservice. It must query for data several
> times per minute, so I am trying to get HTTP/1.1 keepalive support working.
>
> The client code basically works like this:
>
> SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
> SOAPConnection conn = factory.createConnection();
> while(true) {
> SOAPMessage request = generateMyMessage();
> SOAPMessage response = soapConnection.call(request, url);
> try { Thread.sleep(10000); } catch (Exception e) {}
> }
>
>
> noky