1 Reply Latest reply on Apr 30, 2009 5:09 PM by Jim Johnson

    Using StubExt.PROPERTY_CLIENT_TIMEOUT to control timeout of

    Jim Johnson Newbie

      I'm using the native jbossws jax-ws 2.0 implementation. I want to control the timeout on a request I am making to a customer's web service. After searching I found out about setting the property

      StubExt.PROPERTY_CLIENT_TIMEOUT

      on the request context, which I get from my Dispatch object. I set the timeout to 120 seconds (120000 milliseconds). Though my request timed out much quicker than the default timeout, it actually took about 5 minutes for it to time out. The exception thrown said it timed out after "120000ms" but the log entries for the request start & timeout exception are 5 minutes apart. I dropped it down to 90 seconds and it took roughly 4 minutes to time out. Is there something magic about this property that the desired timeout is not being honored? Clearly the property is being used in SOME capacity to control the timeout, it just isn't actually timing out at the desired time. Does anyone have any insight into why this is? Thank you in advance for your time.

        • 1. Re: Using StubExt.PROPERTY_CLIENT_TIMEOUT to control timeout
          Jim Johnson Newbie

          After a lot of time in the debugger I have figured out my issue. I don't think there is a great way to 'solve' it. Basically it looks like there are 3 seperate attempts to 'connect' to the endpoint, each one which honors the timeout. I set my timeout to 45 seconds and it will consistently return from my dispatch.invoke call 2 minutes & 15 seconds later (45 * 3).

          First attempt: org.jboss.remoting.transport.http.HttpClientInvoker.useHttpURLConnection. The call to conn.getOutputStream takes 45 seconds to timeout if the endpoint its trying to connect to is unavailable. This throws an exception that is caught. In the exception handling block there is a call to HttpUrlConnection.getResponseMessage(), which chains to HttpUrlConnection.getResponseCode(). In HttpUrlConnection.getResponseCode() there is a call to HttpUrlConnection.getInputStream() which takes 45 seconds to timeout. After that times out it attempts to call HttpUrlConnection.getHeaderField(0) which also takes 45 seconds to time out. Finally control returns up the stack to my dispatch call where I can deal with the timeout.

          Seems pretty crappy but there doesn't appear to be anything I can do about it. The actual code for HttpUrlConnection leads into closed source SUN code so I've hit a wall for figuring out if there's anything I can do. Anyway hope this info helps someone, maybe someone will read this and have an idea on how to get a true 45 second timeout.