Announcement Announcement Module
Collapse
No announcement yet.
Setting timeout on commons HttpClient Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    hi Dan, did you ever get an answer to this question you posted back in June? I now have the same problem... Thanks

    Comment


    • #3
      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);

      Comment

      Working...
      X