Sending Data in the HTTP Request

You can use several HTTP methods in an HTTP request. Each method sends data in the request in a different manner. For example, the GET method uses the query string of the RequestURI to pass parameter and value pairs. Other methods use the HTTP message body to send data in the request.

Special Characters in HTTP Requests

The Send HTTP Request activity has the following three input elements for sending data in a request:

  • Post Data: corresponds to the body of the HTTP message. All methods except the GET method accept data in this element.
  • Query String: corresponds to the query string of the RequestURI. You can use this input element to dynamically construct the query string using an XPath expression when you do not know the names or number of the input parameters for the request until the activity executes.
  • Parameters: corresponds to the parameters defined in the Parameters field on the General tab. This is useful if you have a fixed set of parameters to send with the request. For requests using the GET method, these parameters are passed as the query string of the RequestURI. For requests using the POST method, these parameters are usually sent as the body of the HTTP message. They can also be included in the query string.

These input elements are mutually exclusive for some methods. For example, for POST requests, you can either specify parameters on the General tab and in the parameters input element or you can specify a PostData input element. However, do not specify both input elements. In the case of a POST request, the PostData input element is ignored when you specify parameters on the General tab.

For GET requests, you can either specify the parameters on the General tab and in the parameters input element or you can specify a QueryString input element. If you know the list of parameters for the request, configure the parameters on the General tab. If the list of parameters is not known until the activity executes, use the QueryString element.

However, when you specify all parameters on the General tab as Optional, you can use the QueryString input element instead of the parameters input element. If any element in the parameters element contains an expression, the QueryString element is ignored.

Depending upon the content type of the data for the request, the request can contain URL-encoded data and the server decodes the data. If this is the case and you want to send special characters such as +, /, or = in your HTTP request, your data string must be URL-encoded if you send the data using the PostData or QueryString input elements. If you send the data using the parameters specified on the General tab, encoding is done automatically.

For example, if you want to specify the following PostData:

name=John Smith&address=500 1/2 Main Street,

the PostData input element should result in the following string:

name=John%20Smith&address=500%201%2F2%20Main%20Street

For more information about the URL specification, see http://www.rfc-editor.org/rfc/rfc1738.txt.