I have a SOAP client generated with apache-cxf(v3.3.2). The client runs inside a Spring Boot application using embedded Tomcat.
How can I specify the keep-alive timeout for this SOAP client?
What I found so far:
The socket used for establishing the connection closes after 5s. This timeout is a hardcoded default in the underlying sun.net.www.http.HttpClient. It is not controlled by the tomcat connection-timeout or com.sun.xml.internal.ws.request.timeout properties. The HttpClient.keepAliveTimeout variable is set only if the Server responds with a Keep-Alive header (e.g. Keep-Alive: timeout=60, max=100 ): see line 752.
The server doesn't provide this header.
According to this answer this is the expected behaviour, but is it really:
The client cannot specify the timeout, it is the server configuration that determines the maximum timeout value. The extra Keep-Alive header can inform the client how long the server is willing to keep the connection open ...