Carefully consider a timeout strategy for web services.
The HTTPClient method times out at 2 minutes for storefront and B2C Commerce tool requests and 15 minutes for jobs.
Salesforce recommends setting timeout values through the service configuration.
The timeout you configure for a service is a connection and read timeout. If each connection/read duration is just below the timeout duration, the total time of the service might be much larger than the timeout value. For example, with a 5 second timeout, with a 4 second connection attempt, followed by reading two chunks of data at 4 seconds apiece, takes about 13 seconds total, but does not time out.
If you don't configure the service timeout values, it is also possible to set stub and port timeouts using API methods, but these are not monitored or included in the service status analytics. However, information about these timeouts is included below.
Stub Timeouts for RPC-Style Services
You
can set the connection time out on a stub using
dw.rpc.Stub._setProperty(Stub.CONNECTION_TIMEOUT, val)
.
The connection timeout controls how long the socket will wait on read
operations before throwing a timeout exception. The default connection
timeout is 5 seconds. The minimum connection timeout is 100 miliseconds
and the maximum connection timeout is 15 seconds.
faultString
method equal to
java.net.SocketTimeoutException: Read timed
out
.You can set the request time out on a stub
using dw.rpc.Stub.setTimeout(val)
. The request time out
(read time out) is the time it takes the web service to respond to a
request message.
Port Timeouts for Document-Style Services
Use the dw.ws.WSUtil
class
to set read/connection timeouts for ports using the
setConnectionTimeout(timeout, port)
and
setRequestTimeout(timeout, port)
methods. The minimum
connection timeout is 100 miliseconds and the maximum connection timeout
is 15 seconds.