Skip to content

SOAPService

This behavior pattern implements SOAP service client.

Behavior Pattern: SOAPServiceBehavior

Property Summary

Property Description Getter Setter
Credential The HTTP Basic Authentication Credentials (if any). GetCredential SetCredential
Name The name of the request operation GetName
ResponseBodyObject The body of the HTTP response deserialized from SOAP into a JavaScript object. GetResponseBodyObject
ResponseBodyText The body of the HTTP response in raw text format. GetResponseBodyText
ResponseHeaders Returns the list of HTTP headers returned with the HTTP response. GetResponseHeaders
ResponseIsErrorStatus Returns 'true 'if an HTTP error code came back from the web service. GetResponseIsErrorStatus
Url The URL being used to access the web service. GetUrl SetUrl

Action Summary

Action Description
DoExecute Executes a SOAP service operation, substituting any of the provided parameter values if necessary.
DoExecuteRaw Sends a SOAP request as is.
DoRemoveParameter Remove one pre-defined parameter.
DoRemoveRequestHeader Remove one pre-defined request header by name.
DoVerify Checks that a given part of response equals the expected value.

Property Detail

Credential

The HTTP Basic Authentication Credentials (if any). Sample code:

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

Type: object

Accessors: GetCredential, SetCredential

Name

The name of the request operation

Type: string

Accessors: GetName

ResponseBodyObject

The body of the HTTP response deserialized from SOAP into a JavaScript object.

Getter Parameters:

Name Type Description
jsonPath string Path to a sub-object within response object. E.g. 'Body.Connection_AuthenticateResult'.
Optional, Default: "Body".
info object Empty object that will receive error information if any. Access as info.error in a calling function.
Optional.

Type: object

Accessors: GetResponseBodyObject

ResponseBodyText

The body of the HTTP response in raw text format.

Type: string

Accessors: GetResponseBodyText

ResponseHeaders

Returns the list of HTTP headers returned with the HTTP response. Sample code:

var headers = SeS("Operation_Name").GetResponseHeaders();
for (var i = 0; i < headers.length; i++)
{
    var name = headers[i].Name;
    var value = headers[i].Value;
}

Type: object

Accessors: GetResponseHeaders

ResponseIsErrorStatus

Returns 'true 'if an HTTP error code came back from the web service.

Type: boolean

Accessors: GetResponseIsErrorStatus

Url

The URL being used to access the web service.

Type: string

Accessors: GetUrl, SetUrl

Action Detail

DoExecute

Executes a SOAP service operation, substituting any of the provided parameter values if necessary.

DoExecute(method, params, headers) 

Parameters:

Name Type Description
method string Name of a SOAP method.
params object JavaScript object {"name1": "value1", "name2": "value2" }. Parameter values that should be passed to the web service operation.
headers object Array of header name/value pairs.

Returns:

boolean: 'true' if success, 'false' otherwise.

DoExecuteRaw

Sends a SOAP request as is.

DoExecuteRaw(method, body, params) 

Parameters:

Name Type Description
method string Name of a SOAP method.
body string SOAP xml string.
params object JavaScript object {"name1": "value1", "name2": "value2" }. Parameter values that should be passed to the web service operation.

Returns:

boolean: 'true' if success, 'false' otherwise.

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

DoVerify

Checks that a given part of response equals the expected value.

DoVerify(msg, jsonPath, expectedValue) 

Parameters:

Name Type Description
msg string Message to write into the report.
jsonPath string Path to the given node in the response object to use as a root for comparison with the expected value.
expectedValue object Expected value.

Returns:

boolean: 'true' if success, 'false' otherwise.