Web Service Timeouts

Including web service timeouts in the script that calls the web service can have significant performance effects on your entire site, not just your web service implementation. Salesforce strongly recommends using the service framework to implement appropriate timeouts. However, as of Salesforce B2C Commerce 14.4, only the legacy web service implementation is supported by the web service framework. For new web service implementations, carefully consider a timeout strategy.

SOAP Timeout for Unresponsive Server

SOAP web service connections use a default timeout of 2 minutes for storefront and B2C Commerce tool requests and 15 minutes for jobs. If the timeout of the calling script is less than the default, the script timeout is used.
Tip: To ensure the site's responsiveness, configure a low timeout.

HTTPClient Timeout

The HTTPClient method times out at 2 minutes for storefront and B2C Commerce tool requests and 15 minutes for jobs.

Setting Timeouts

Salesforce recommends setting timeout values through the service configuration. See also Configuring Web Services in Business Manager.

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.

If you set the Stub timeout to greater than the Script timeout, B2C Commerce automatically adjusts the timeout to be less than or equal to the script timeout value. If the Stub doesn't return within the timeout window, the script will exit on the Error transition with a Script Timeout exception.
Note: If you set the Stub timeout to a value that is lower than the Script timeout, the Stub will throw an Error, with the 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.