ws-soap-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Nichol" <snicholn...@scottnichol.com>
Subject Re: SOAP timeouts over a proxy
Date Wed, 25 Feb 2004 03:25:10 GMT
The current code (post-2.3.1) does what you suggest and even gracefully falls back when a pre-1.4
JVM is used.  You can download a nightly build from http://cvs.apache.org/dist/soap/nightly/2003-09-09/,
or grab the source from CVS.

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.
----- Original Message ----- 
From: <Raoul.Golan@alcatel.com.au>
To: <soap-dev@ws.apache.org>
Sent: Tuesday, February 24, 2004 7:56 PM
Subject: SOAP timeouts over a proxy


Greetings,

We're developing a system which uses Apache SOAP over 
HTTP / SSL.  We're also finding a situation where the client can
hang indefinitely if it's going through a proxy and the proxy does 
not return (we've seen a SOAP call hang for over 10 minutes in
this way - with an exception once the proxy came back to life).
Setting the timeout on the Call object does not help, since that
only applies to the read once the server reached.

Lines 102-118 of SSLUtils.java in Apache SOAP 2.3.1 are as follows:

           /* 
            * If a proxy has been set...
            * Set up a socket to do tunneling through the proxy.
            * Start it off as a regular socket, then layer SSL
            * over the top of it.
            */
           if (tunnelHost==null) {
              sslSocket = (SSLSocket)factory.createSocket(host, port);
           } else {
              Socket tunnel = new Socket(tunnelHost, tunnelPort);
              doTunnelHandshake(tunnel, host, port);

              // Overlay tunnel socket with SSL
              sslSocket = (SSLSocket)factory.createSocket(tunnel, host, 
port, true);
           }

If the proxy happens to hang during the tunnel handshake, then the
SOAP call will hang indefinitely.  The programmer has no control
on how long to wait as there is no way to currently specify a timeout
period.

What would be nice is if the programmer could specify a timeout period
in which the proxy must respond before throwing an exception.

Something like this:

           /* 
            * If a proxy has been set...
            * Set up a socket to do tunneling through the proxy.
            * Start it off as a regular socket, then layer SSL
            * over the top of it.
            */
           if (tunnelHost==null) {
              InetSocketAddress addr = new InetSocketAddress(host, port);
              sslSocket = (SSLSocket)factory.createSocket();
              sslSocket.connect(addr, connectTimeout);
            } else {
              InetSocketAddress tunnelAddr = new 
InetSocketAddress(tunnelHost, tunnelPort);
              Socket tunnel = new Socket();
              tunnel.connect(tunnelAddr, connectTimeout);
              tunnel.setSoTimeout(handshakeTimeout);
              doTunnelHandshake(tunnel, host, port);

              // Overlay tunnel socket with SSL
              sslSocket = (SSLSocket)factory.createSocket(tunnel, host, 
                                                          port, true);
        }

This specifies a connectTimeout for the connect, and a handshake timeout
for the doTunnelHandshake. 

Any thoughts on this?

Many thanks,

Raoul Golan
raoul.golan@alcatel.com.au

Mime
View raw message