Skip to content

Session

Session object for SOAP and REST services.

Action Summary

Action Description
DoRemoveParameter Remove one pre-defined parameter.
DoRemoveRequestHeader Remove one pre-defined request header by name.
GetCredential Returns HTTP Basic Authentication credentials (if any).
GetNewRequest Create new RESTService object with 'GET' method and specified url.
GetParameters Return common request parameters (array of `[{'Name':somename,'Value':somevalue},.
GetProxyHost Returns proxy host.
GetProxyPort Returns proxy port.
GetProxyPwd Returns proxy password.
GetProxyUser Returns proxy user name.
GetRequestHeaders Return common HTTP Headers applied to each REST or SOAP request (array of `[{'Name':somename,'Value':somevalue},.
GetRESTRequest Create new RESTService object with 'GET' method and specified url.
SetBaseUrl Enable URL replacement for all further requests.
SetCredential Sets HTTP Basic Authentication Credentials.
SetIgnoreStatus Set to true to prevent REST requests with non 200 status code from failing the test.
SetParameter Sets common request parameter.
SetParameters Sets common request parameters.
SetProxy Sets proxy settings for the Session.
SetProxyHost Sets proxy host.
SetProxyPort Sets proxy port.
SetProxyPwd Sets proxy password.
SetProxyUser Sets proxy user name.
SetRequestHeader Sets common request header.
SetRequestHeaders Sets common HTTP Headers applied to each REST or SOAP request.
SetUrl Deprecated.

Action Detail

DoRemoveParameter

Remove one pre-defined parameter. Requires Rapise 6.6+

Session.DoRemoveParameter(name)

Parameters:

Name Type Description
name string Parameter name

DoRemoveRequestHeader

Remove one pre-defined request header by name. Requires Rapise 6.6+

Session.DoRemoveRequestHeader(name)

Parameters:

Name Type Description
name string Header name

GetCredential

Returns HTTP Basic Authentication credentials (if any).

Session.GetCredential()

GetNewRequest

Create new RESTService object with 'GET' method and specified url.

Session.GetNewRequest(url, name)

Parameters:

Name Type Description
url string Request URL
name string Request name used to display in the report
Optional.

GetParameters

Return common request parameters (array of [{'Name':somename,'Value':somevalue},...])

Session.GetParameters()

GetProxyHost

Returns proxy host. Requires Rapise 8.1+.

Session.GetProxyHost()

GetProxyPort

Returns proxy port. Requires Rapise 8.1+.

Session.GetProxyPort()

GetProxyPwd

Returns proxy password. Requires Rapise 8.1+.

Session.GetProxyPwd()

GetProxyUser

Returns proxy user name. Requires Rapise 8.1+.

Session.GetProxyUser()

GetRequestHeaders

Return common HTTP Headers applied to each REST or SOAP request (array of [{'Name':somename,'Value':somevalue},...])

Session.GetRequestHeaders()

GetRESTRequest

Create new RESTService object with 'GET' method and specified url.

Session.GetRESTRequest(defNameOrPath, id)

Parameters:

Name Type Description
defNameOrPath string Path to the .rest definition file
id string Name of the request (as specified in the .rest definition file)

SetBaseUrl

Enable URL replacement for all further requests. If request URL starts with oldUrl then replace the beginning with newUrl. Requires Rapise 6.6+

Session.SetBaseUrl(oldUrl, newUrl)

Parameters:

Name Type Description
oldUrl string URL to find
newUrl string new URL to use instead of oldUrl

SetCredential

Sets HTTP Basic Authentication Credentials. Sample code:

var credential = {};
credential.UserName = "fredbloggs";
credential.Password = "MyPassword";
SeS("Operation_Name").SetCredential(credential);

Another way is to pass user name and password as first and second parameter respectively, e.g. SeS("Operation_Name").SetCredential("fredbloggs", "MyPassword");

Session.SetCredential(value, value2)

Parameters:

Name Type Description
value string | object User name or full object with credentials.
value2 string Password string. Do not set this parameter if you pass object as the first one.

SetIgnoreStatus

Set to true to prevent REST requests with non 200 status code from failing the test. It would <req>.DoExecute() will just return true/false but the line in report will always be marked as Passed.

Session.SetIgnoreStatus(ignore)

Parameters:

Name Type Description
ignore boolean true to ignore status code

SetParameter

Sets common request parameter. This parameter will be applied to all further REST and SOAP requests.

Session.SetParameter(name, value)

Parameters:

Name Type Description
name string Parameter name
value string Parameter value

SetParameters

Sets common request parameters. These parameters will be applied to all further REST and SOAP requests. Accepts one of:

  • Full array of parameters: [{'Name':somename,'Value':somevalue},...]
  • Single parameter as object: {'Name':somename,'Value':somevalue}
  • Single parameter as 2 input parameters: Session.SetParameters(name,value).
Session.SetParameters(requestParam, optValueVal)

Parameters:

Name Type Description
requestParam object Parameters or single parameter.
optValueVal string Parameter value, when specified. If this value is set, then 'requestParam' should be a string and method signature will be Session.SetParameters('name','value')
Optional.

SetProxy

Sets proxy settings for the Session. Requires Rapise 8.1+.

Session.SetProxy(host, port, user, pwd)

Parameters:

Name Type Description
host string Proxy host name or IP address.
port string Proxy port.
user string Proxy user name.
pwd string Proxy password.

SetProxyHost

Sets proxy host. Requires Rapise 8.1+.

Session.SetProxyHost(value)

Parameters:

Name Type Description
value string Host name or IP address.

SetProxyPort

Sets proxy port. Requires Rapise 8.1+.

Session.SetProxyPort(value)

Parameters:

Name Type Description
value string Port number.

SetProxyPwd

Sets proxy password. Requires Rapise 8.1+.

Session.SetProxyPwd(value)

Parameters:

Name Type Description
value string Proxy password.

SetProxyUser

Sets proxy user name. Requires Rapise 8.1+.

Session.SetProxyUser(value)

Parameters:

Name Type Description
value string User name.

SetRequestHeader

Sets common request header. This header will be applied to all further REST and SOAP requests.

Session.SetRequestHeader(name, value)

Parameters:

Name Type Description
name string HTTP header name
value string HTTP header value

SetRequestHeaders

Sets common HTTP Headers applied to each REST or SOAP request. Accepts one of:

  • Full array of headers: [{'Name':somename,'Value':somevalue},...]
  • Single header as object: {'Name':somename,'Value':somevalue}
  • Single header as 2 input parameters: Session.SetRequestHeaders(name, value)
Session.SetRequestHeaders(requestParam, optValueVal)

Parameters:

Name Type Description
requestParam object Header(s) object or single header name.
optValueVal string Header value, when specified. If this value is set, then 'requestParam' should be a string and method signature will be Session.SetRequestHeaders('name','value')
Optional.

SetUrl

Deprecated. Same as SetBaseUrl.

Session.SetUrl(oldUrl, newUrl)

Parameters:

Name Type Description
oldUrl string URL to find
newUrl string new URL to use instead of oldUrl