My Oracle Support Banner

Problem While Setting a Timeout from a JRF WebService in a WebCenter Portal Framework Application (Doc ID 2017726.1)

Last updated on MARCH 07, 2019

Applies to:

Oracle WebCenter Portal - Version and later
Information in this document applies to any platform.


Experiencing problems while setting a timeout using a WebService Proxy Client inside a WebCenter Portal Framework application.

In summary, what happens is that you attempt to set a timeout for the WebService client call and such seems not to take effect.
You can simply verify this, by setting some code around the WebService call, like:

      startTime = System.currentTimeMillis();
      endTime = System.currentTimeMillis();
      System.out.println("That has taken " + (endTime - startTime) + " milliseconds");

The time measured will be higher then what you've set.


Within the custom code to set the timeout for the WebService call you should have something like the following:

    public static IServiceWeather getWeatherServiceInstance() {
        if(weatherService == null) {
            try {
                Context ctx = ADFContext.getCurrent().getConnectionsContext();
                WebServiceConnection wsc = (WebServiceConnection)ctx.lookup("weather");
                weatherService = wsc.getJaxWSPort(IServiceWeather.class);
                Map<String, Object> requestContext = ((BindingProvider)weatherService).getRequestContext();
                // WS Connection Timeout
                // ---------------------
                // Specifies, in seconds, how long a client application that is attempting to invoke a Web
                // service waits to make a connection. After the specified time elapses, if a connection
                // hasn't been made, the attempt times out.
                requestContext.put(BindingProviderProperties.CONNECT_TIMEOUT, 500);

                // WS Request Timeout
                // ------------------
                // Specifies, in seconds, how long a client application waits for a response from a Web
                // service it is invoking. After the specified time elapses, if a response hasn't arrived,
                // the client times out.
                requestContext.put(BindingProviderProperties.REQUEST_TIMEOUT, 5000);

            } catch (Exception e) {
                log.log(Level.SEVERE, e.getMessage(), e.getCause());
        return weatherService;


In a simple JDeveloper Generic application and not using JFR webservices, the functionality works as expected.



Do remember a couple of things:

  1. The timeout setting won't be really the timeout for the entire WebService client call ( request from the client + connection to the WebService + execution of the WebService + response to the client );
  2. You'll be only able to set the connection or the request/execution timeout of the WebService, not the overall timeout of the WebService client call itself.

A possible way out for this could be to use a Thread class (eg, extend it) and use a thread to invoke the WebService client and later after X time, kill it.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.