Nexial Automation

Test Automation Platform for everyone!

X

ws » post(url,body,var)

Description

This command is used to send POST request to the given endpoint URL. This could be used for both SOAP and RESTful Services.

If the Web Service is to be accessed with Basic Authentication, provide the username and password in the data file with the below shown keywords.

To learn about how to utilize the response returned from the target URL, click here.

Expressing body as file content

Note that this command support automatic content resolution via:

  • Fully qualified file path, or
  • URL (GET only)
    • When the body parameter contains a valid URL, Nexial’s default behavior is to treat it as is(meaning, Nexial won’t resolve its content). One can instruct Nexial to automatically resolve the underlying content by setting the nexial.resolveTextAsURL to true.

When body is specified as a fully qualified file path or a valid URL, Nexial will attempt to extract the corresponding file content as the request payload. Such content can be resolved as text or binary content depending on the Content-Type header defined (via head(url,var)) prior to the execution of this command. Alternatively, one can enforce Nexial to treat the corresponding file content as binary via the nexial.ws.requestPayloadAsRaw System variable.

In addition, if the corresponding file content is to be treated as text, the following System variables may have some impact as well:

Parameters

  • url - the target URL
  • body - the payload to send, or (empty) if none is to be send
  • var - the variable to hold the response

Example

Script:

Output:

See Also