Results 1 to 3 of 3

Thread: Setting timeout on commons HttpClient

  1. #1
    Join Date
    Sep 2004
    Posts
    127

    Default Setting timeout on commons HttpClient

    Hi,

    I'm using WebServiceTemplate with CommonsHttpMessageSender to access a remote web service.

    By default, commons HttpClient's timeout is set to infinite, which I'd like to shorten just a little bit. Unfortunately, the following seems to have no effect at all (copied from HttpClient's docs):

    Integer timeoutMs = new Integer(5 * 1000);
    messageSender.getHttpClient().getParams().setParam eter("http.socket.timeout", timeoutMs);
    messageSender.getHttpClient().getParams().setParam eter("http.connection.timeout", timeoutMs);

    Am I missing something?

    Thanks,
    Dan

  2. #2
    Join Date
    Jan 2008
    Posts
    1

    Default

    hi Dan, did you ever get an answer to this question you posted back in June? I now have the same problem... Thanks

  3. #3
    Join Date
    Sep 2004
    Posts
    127

    Default

    Sorry I missed your post earlier. This code seems to do the trick:

    Code:
    Integer timeoutMs = new Integer(5 * 1000);
    messageSender.getHttpClient().getParams().setSoTimeout(timeoutMs);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •