Class Stub

This is the base class for all service stubs accessible through a WebReference object. The Stub provides access to the WSDL operations.

Demandware recommends a low timeout to ensure responsiveness of the site and to avoid thread exhaustion. Use the Services module in Business Manager to set timeout values, not the methods for this class. The Services module provides better analytics and timeout management.

The default timeout, if not set, is 15 minutes when the web service is used in a job, and 2 minutes otherwise. If the timeout of the calling script is lower, the script timeout is used.

1// get WebReference
2    var webref : WebReference = webreferences.myWSDLname;
3 // get service stub
4    var stub : Stub = webref.defaultService;

See Also:

Deprecated:

This class is deprecated, please use webreferences2 instead (see also Port).

Warning

Constant Summary 

ConstantDescription
CONNECTION_TIMEOUT: StringThis property allows the user to set the web service connection timeout value in milliseconds.
ENDPOINT_ADDRESS_PROPERTY: StringStandard property: target service endpoint address.
PASSWORD_PROPERTY: StringStandard property: password for authentication.
SESSION_MAINTAIN_PROPERTY: StringStandard property: this boolean property is used by a service client to indicate whether or not it wants to participate in a session with a service endpoint.
USERNAME_PROPERTY: StringStandard property: user name for authentication.

Property Summary 

PropertyDescription
password: StringReturns the password.
timeout: NumberReturns the current read timeout value in milliseconds for this Stub.
username: StringReturns the user name.

Constructor Summary 

ConstructorDescription
Stub()

Method Summary 

MethodDescription
_getProperty(String)Gets the value of a specific configuration property.
_setProperty(String, Object)Sets the name and value of a configuration property for this Stub instance.
getPassword()Returns the password.
getTimeout()Returns the current read timeout value in milliseconds for this Stub.
getUsername()Returns the user name.
setHeader(String, String, Object)Sets an additional SOAP header value for the next operation.
setPassword(String)Sets the password.
setTimeout(Number)Sets the timeout in milliseconds for the next call through this Stub.
setUsername(String)Sets the user name.

Methods inherited from class Object 

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constant Details 

CONNECTION_TIMEOUT 

CONNECTION_TIMEOUT: String

This property allows the user to set the web service connection timeout value in milliseconds. By default, the web service connection timeout is 5000 milliseconds (5 seconds). The minimum allowed value is 100 milliseconds and the maximum allowed value is 15000 milliseconds (15 seconds). Demandware recommends setting timeout values in Business Manager Services module as it provides better analytics and timeout management.

Deprecated:

use webreferences2 instead

Warning


ENDPOINT_ADDRESS_PROPERTY 

ENDPOINT_ADDRESS_PROPERTY: String

Standard property: target service endpoint address. The URI scheme for the endpoint address specification must correspond to the protocol/transport binding for this stub class.

Deprecated:

use webreferences2 instead

Warning


PASSWORD_PROPERTY 

PASSWORD_PROPERTY: String

Standard property: password for authentication.

Deprecated:

use webreferences2 instead

Warning


SESSION_MAINTAIN_PROPERTY 

SESSION_MAINTAIN_PROPERTY: String

Standard property: this boolean property is used by a service client to indicate whether or not it wants to participate in a session with a service endpoint. If this property is set to true, the service client indicates that it wants the session to be maintained. If set to false, the session is not maintained. The default value for this property is false.

Deprecated:

use webreferences2 instead

Warning


USERNAME_PROPERTY 

USERNAME_PROPERTY: String

Standard property: user name for authentication.

Deprecated:

use webreferences2 instead

Warning


Property Details 

password 

password: String

Returns the password.

Deprecated:

use webreferences2 instead

Warning


timeout 

timeout: Number

Returns the current read timeout value in milliseconds for this Stub.

Deprecated:

use webreferences2 instead

Warning


username 

username: String

Returns the user name.

Note: this method handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2, 4, and 12.

Deprecated:

use webreferences2 instead

Warning


Constructor Details 

Stub() 

Stub()


Method Details 

_getProperty(String) 

_getProperty(name: String): Object

Gets the value of a specific configuration property.

Parameters:

  • name - Name of the property whose value is to be retrieved

Returns:

  • Value of the configuration property

Deprecated:

use webreferences2 instead

Warning


_setProperty(String, Object) 

_setProperty(name: String, value: Object): void

Sets the name and value of a configuration property for this Stub instance. If the Stub instance contains a value for the same property, the old value is replaced.

Note: the _setProperty method may not perform a validity check on a configured property value. An example is the standard property for the target service endpoint address, which is not checked for validity in the _setProperty method. In this case, stub configuration errors are detected at the remote method invocation.

Parameters:

  • name - Name of the configuration property
  • value - Value of the property

Deprecated:

use webreferences2 instead

Warning


getPassword() 

getPassword(): String

Returns the password.

Returns:

  • the password. Note: this method handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2, 4, and 12.

Deprecated:

use webreferences2 instead

Warning


getTimeout() 

getTimeout(): Number

Returns the current read timeout value in milliseconds for this Stub.

Returns:

  • the current timeout value for this Stub.

Deprecated:

use webreferences2 instead

Warning


getUsername() 

getUsername(): String

Returns the user name.

Note: this method handles sensitive security-related data. Pay special attention to PCI DSS v3. requirements 2, 4, and 12.

Returns:

  • the user name.

Deprecated:

use webreferences2 instead

Warning


setHeader(String, String, Object) 

setHeader(namespace: String, name: String, value: Object): void

Sets an additional SOAP header value for the next operation.

Parameters:

  • namespace - the namespace to use.
  • name - the name of the header item.
  • value - the value for the header item.

Deprecated:

use webreferences2 instead

Warning


setPassword(String) 

setPassword(password: String): void

Sets the password.

Parameters:

  • password - the password to set.

Deprecated:

use webreferences2 instead

Warning


setTimeout(Number) 

setTimeout(timeout: Number): void

Sets the timeout in milliseconds for the next call through this Stub.

This timeout value controls "read timeout" (how long, after connecting, it will wait without any data being read). To control "connection timeout" you use the _setProperty(String, Object) method where the name parameter is CONNECTION_TIMEOUT.

Parameters:

  • timeout - the timeout for the next call through this stub.

See Also:

Deprecated:

use webreferences2 instead

Warning


setUsername(String) 

setUsername(username: String): void

Sets the user name.

Parameters:

  • username - the user name to set.

Deprecated:

use webreferences2 instead

Warning