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).
GetParameters Return common request parameters (array of `[{'Name':somename,'Value':somevalue},.
GetRequestHeaders Return common HTTP Headers applied to each REST or SOAP request (array of `[{'Name':somename,'Value':somevalue},.
SetBaseUrl Enable URL replacement for all further requests.
SetCredential Sets HTTP Basic Authentication Credentials.
SetParameter Sets common request parameter.
SetParameters Sets common request parameters.
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+

DoRemoveParameter(name) 

Parameters:

Name Type Description
name string Parameter name

DoRemoveRequestHeader

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

DoRemoveRequestHeader(name) 

Parameters:

Name Type Description
name string Header name

GetCredential

Returns HTTP Basic Authentication credentials (if any).

GetCredential() 

GetParameters

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

GetParameters() 

GetRequestHeaders

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

GetRequestHeaders() 

SetBaseUrl

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

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");

SetCredential(value, value2) 

Parameters:

Name Type Description
value 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.

SetParameter

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

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).
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.

SetRequestHeader

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

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)
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.

SetUrl(oldUrl, newUrl) 

Parameters:

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