Send HTTP Request

Send HTTP Request is an asynchronous activity that sends an HTTP request and waits for a response from the web server. This activity sends a request to a server that is compliant with either the HTTP 1.0, 1.1, or 2.0 specification. HTTP 2.0 is supported only when the HTTP version at the client shared resource is set to HTTP 2. TIBCO ActiveMatrix BusinessWorks™ automatically sends the request using the correct version based on the version supported by the HTTP server. Therefore, do not specify the HTTP version of the server you are sending the request to.

General

Note: When configuring an HTTP activity, configuring an HTTP Connector shared resource as the value for a module property is not supported. Configure a literal value instead.

The General tab has the following fields.

Field Description
Name The name to be displayed as the label for the activity in the process.
HTTP Client Specifies the HTTP Client shared resource. For more information, see HTTP Client.
Parameters The parameters of the HTTP request. For each parameter, you must provide:
  • Parameter Name
  • Parameter Type as string
  • Parameter Cardinality as Optional, Required, or Repeating

These parameters are specified in the parameters element on the Input tab.

Post Data Type The body of the HTTP message. You can select either String or Binary format.

Description

Provide a short description of the activity.

Advanced

The Advanced tab has the following fields.

Field Literal Value/ Module Property Description
Provide Client Resource None Select this check box to dynamically select the needed HTTP client resource. When you select this check box, Host and Port fields disappear, and the ClientResource field appears in the Input tab.
Write to File None Select this check box to write the incoming requests that exceed the specified threshold size to a file instead of storing the request in memory. You can accept large incoming requests without consuming a great deal of memory. Selecting this check box displays the Directory and Threshold Data Size fields.
Note: To keep the incoming requests in memory, do not select this check box.
Note: The files created using this option after writing are not deleted automatically. You must manage the storage used by these files. Delete these files when they are no longer in use.
Directory Yes The directory to write messages that are above the specified threshold. The process engine does not attempt to create the directory if the specified directory does not exist. Therefore, create the directory before starting the process engine.
Creating Non-Existing Directories None Selecting this check box creates all directories in the path specified in the Directory field, if they do not already exist.

Not selecting this check box with one or more non-existing directories in the specified path in the Directory field, raises an exception.

Threshold Data Size(bytes) Yes The maximum size (in bytes) of an incoming request to be kept in memory. Requests larger than the specified size are written to a file in the specified directory. The file’s name is the output so that subsequent activities in the process can access the file and read its contents.

Specifying zero (0) in this field causes all incoming requests to be saved to a file.

Write Non MIME Content None Select this check box to save the non-MIME attachments or data downloaded from the server to a disk.

Input Editor

Input Editor comprises the data structure of the headers of the HTTP request and HTTP reply message. You can either use the default structure or modify the structure, if the outgoing request or the reply to the request has a specific data structure for the header.

Note: If you add a new primitive element, and that element is not a defined HTTP standard header, the server lists the element in the DynamicHeaders section.
Input Header Datatype Description
Accept string This field specifies media types that are acceptable for response messages for the request. For example, text/*, text/html. Media types are described in the HTTP specification at w3.org.

If no Accept-Header field is specified, all media types are acceptable on the server.

Accept-Charset string This field specifies the character sets that are acceptable for response messages for the request. For example, iso-8859-5, unicode-1-1. The character sets are described in the HTTP specification at w3.org.

If no Accept-Charset header is specified, any character set is acceptable on the server.

Accept-Encoding string This field specifies the content-coding values that are acceptable for response messages. For example, compress and gzip.

For more information about this header field, see HTTP specification at w3.org.

Content-Type string This field indicates the media type of the entity body for the outgoing message and the incoming response. Media types are described in the HTTP specification at w3.org. An example of the media type is text/html; charset=ISO-8850-4.
Cookie string A name and value pair (also known as a cookie) containing information that the HTTP server may be expecting. For correct parsing and processing of cookies, input must be in the format "key=value".

You can set the cardinality for this element to Repeating (*) to specify more than one cookie. You can also specify multiple name or value pairs in a single non-repeating element by separating each pair with a comma (for example, "name1=value1, name2=value2").

Pragma string This field is used to include implementation-specific directives that might apply to the receiver.

For more information about this field, see the HTTP specification at w3.org.

Output Editor

Output Editor comprises the data structure of the headers of the HTTP request and HTTP reply message. You can either use the default structure or modify the structure, if the outgoing request or the reply to the request has a specific data structure for the header.

The HTTP protocol defines the header structure. For more information about the fields and content of the header of an HTTP request, see the HTTP specification at w3.org.

Output Header Datatype Description
Allow string This field lists the set of methods supported by the resource identified by RequestURI.
Content-Type string This field indicates the media type of the entity body for the outgoing message and the incoming response. Media types are described in the HTTP specification at w3.org.

An example of the media type is text/html; charset=ISO-8850-4

.
Content-Length string This field indicates the size of the entity body (in decimal number of OCTETs) of the response message.
Content-Encoding string This field is used as a modifier to the content-type. When present, its value indicates what additional content encoding has been applied to the entity-body. Also, what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field.

Content-Encoding is primarily used to allow a document to be compressed without losing the identity of its underlying media type.

For more information about this field, see the HTTP specification at w3.org.

Date string The date and time when the response message was sent.
Location string This field is used to redirect the receiver to a location other than RequestURI for completion of the request or for identification of a new resource.
Set-Cookie string The cardinality for this field is set to Repeating (*).
Note: For correct parsing and processing of cookies, input must be in the format "key=value".

For more information about this field, see the HTTP specification at w3.org.

Pragma string This field is used to include implementation-specific directives that might apply to the receiver.

For more information about this field, see the HTTP specification at w3.org.

Input

The following is the input for the activity.

Input Item Datatype Description
ClientResource string This field appears when you select the Provide Client Resource check box on the Advanced tab. Provide the HTTP client shared resource name to which you want to connect dynamically.

The client resource name to be provided in the input tab should be of the form <Package Name>.<Resource Name>.

Note: Do not provide .httpClientResource extension in the client resource name.
Host string The HTTP host you want to connect to. Specifying a value for this input item overrides any value specified on the General tab.
Port string The port number that the HTTP server uses for incoming requests. Specifying a value for this input item overrides any value specified on the General tab.
Method string The HTTP method to use for the request. All HTTP 1.1 methods are supported, but the connect method is unnecessary because ActiveMatrix BusinessWorks™ automatically uses the CONNECT method when connecting through a proxy server.

If no method is specified in this element, the GET method is used by default.

RequestURI string The address portion of the request. This is the portion of the URI before the question mark (?).
PostData string The message body of the HTTP request. Do not specify this element when the method of the request is GET.

For more information about this input element, see Sending Data in the HTTP Request

QueryString string The query string portion of the request. This is the part after the question mark (?).

For more information about this input element, see Sending Data in the HTTP Request

Timeout integer The amount of time (in milliseconds) to wait for a response from the HTTP server.
Headers complex The header fields to send for the request. When this element is specified on the Input Editor tab, you can use this input item to provide values for the header when sending the request.
DynamicHeaders complex The dynamic header is an additional header parameter to add runtime headers to the outgoing HTTP messages. This element is specified in the Input tab.
Note: You can use only US-ASCII characters in DynamicHeaders.

The DynamicHeaders consists of the following information:

  • Name: the name of the header
  • Value: the value of the header

You can consider the following overriding conditions.

  • Overrides the value of HeaderName with the value found in DynamicHeaders if it is a non-repeating header. If more than one occurrence of this header is found under DynamicHeaders, it generates the following exception.

    The header [ headerName ] is defined as non-Repeating Header in Input Headers. This header cannot have multiple occurences in DynamicHeaders.

  • If it is a repeating element, add the respective name value pairs under dynamic headers, which is then added to the existing list maintained for this element.
  • For a repeating element, if the new header name is not found under the "Headers" section declared through TIBCO Business Studio™ for BusinessWorks™, the following is added into HTTP headers.
    • Shows only one value, if found once in DynamicHeaders.
    • Shows an array of values, if found repeating in DynamicHeaders.

If you add any Standard HTTP Header as a name value pair in the Dynamic Header section in the client end, on the server side this is listed under the Headers section.

parameters complex This element contains parameters added in the Parameters field in the General tab.
mimeEnvelopeElement complex This element contains the message attachments.

This element contains a repeating element named mimePart that contains each mime attachment.

mimeHeaders complex This element contains the mime header for each mimePart. mimeHeaders can contain the following information:
  • content-disposition: To suggest a filename for an attachment, use "*;filename=<filename>" in this element.
    Note: The HTTP servers may alter or ignore the suggested name.
  • content-type
  • content-transfer-encoding
  • content-id

For more information about MIME headers and their syntax, see http://www.faqs.org/rfcs/rfc2045.html.

Note: When the content type is specified as "text/*" (for example, "text/xml"), the attachment content is in either the textContent input element or the file name storing the attachment is in the fileName input element. When the content type is anything other than "text/*", the attachment content is in either the binaryContent input element or the file name storing the attachment is in the fileName input element.
binaryContent | textContent | fileName choice This element contains the mime attachment.

The element can be one of the following:

  • binaryContent: content of the attachment when the attachment is binary data.
  • textContent: content of the attachment when the attachment is text data.
  • fileName: the file name of the attachment written to the disk.

Output

The following is the output of the activity.

Input Item Datatype Description
Header complex The fields of the header specified on the Output Editor tab.

For more information about these items, see the description of the Output Editor tab.

statusLine complex This field is the first line of the response message. This consists of the protocol version, a numeric status code, and the text phrase explaining the status code.

For more information about status codes in the HTTP responses, see the HTTP specification at w3.org.

httpVersion string The HTTP method to use for the request. All HTTP 1.1 methods are supported, but the connect method is unnecessary because ActiveMatrix BusinessWorks automatically uses the CONNECT method when connecting through a proxy server.

If no method is specified in this element, by default the GET method is used.

statusCode string The address portion of the request. This is the portion of the URI before the question mark (?).
reasonPhrase string The message body of the HTTP request. Do not specify this element when the method of the request is GET.

For more information about this input element, see Sending Data in the HTTP Request

binaryContent string The binary content of the response to the request from the HTTP server.
asciiContent integer The ASCII content of the response to the request from the HTTP server.
filePath string The location of the file on the disk at which the non-MIME attachment is written .
Headers complex The header fields of the reply. The structure of this output item is specified on the Output Headers tab.
DynamicHeaders complex The dynamic header is an additional header parameter to add runtime headers to the outgoing HTTP messages. This element is specified in the Input tab.
Note: You can use only US-ASCII characters in DynamicHeaders.

The dynamic headers consist of the following information:

  • Name: the name of the header
  • Value: the value of the header

You can consider the following overriding conditions.

  • Overrides the value of HeaderName with the value found in DynamicHeaders if it is a non-repeating header. If more than one occurrence of this header is found under DynamicHeaders, it generates the following exception.

    The header [ headerName ] is defined as non-Repeating Header in Input Headers. This header cannot have multiple occurences in DynamicHeaders.

  • If it is a repeating element, add the respective name or value pairs under DynamicHeaders, which is added to the existing list maintained for this element.
  • For a repeating element, if the new header name is not found under the Headers section declared through TIBCO Business Studio for BusinessWorks, the following is added into HTTP headers.
    • Shows only one value, if found once in DynamicHeaders.
    • Shows an array of values, if found repeating in DynamicHeaders.
mimeEnvelopeElement complex This element contains the message attachments.

This element contains a repeating element named mimePart that contains each mime attachment.

mimeHeaders complex This element contains the mime header for each mimePart. mimeHeaders can contain the following information:
  • content-disposition: to suggest a filename for an attachment, use "*;filename=<filename>" in this element.
    Note: The HTTP servers may alter or ignore the suggested name.
  • content-type
  • content-transfer-encoding
  • content-id

For more information about MIME headers and their syntax, see http://www.faqs.org/rfcs/rfc2045.html.

Note: When the content type is specified as "text/*" (for example, "text/xml"), the attachment content is expected to be in either the textContent input element or the file name storing the attachment is expected to be in the fileName input element. When the content type is anything other than "text/*", the attachment content is in either the binaryContent input element or the file name storing the attachment is in the fileName input element.
binaryContent | textContent | fileName choice This element contains the mime attachment.

The element can be one of the following:

  • binaryContent: content of the attachment when the attachment is binary data.
  • textContent: content of the attachment when the attachment is text data.
  • fileName: the file name of the attachment written to the disk.

Fault

The Fault tab lists the possible exceptions generated by this activity. For more information about error codes and the corrective actions to take, see the TIBCO ActiveMatrix BusinessWorks™ Error Codes guide.

Fault Generated When..
ActivityTimedOutException A timeout has been reached.
HttpClientException The HTTP server responds with a message containing the 4XX status code.
HttpServerException The HTTP server responds with a message containing the 5XX status code.
HttpCommunicationException An HTTP exception occurred while executing the specified method, or when trying to read the response.

Threading Policy Details

The following are the details about Send HTTP Request activity threading policy.

Activity Type Multi-Threaded? Default Thread Count Thread Count Configuration
Asynchronous Yes Dynamic This field can be configured by using the Thread Pool shared resource.

Policy

Activities that support policies display the Policy tab. To associate a new or existing policy with the Send HTTP Request activity, click the Add Policy to Activity icon. To edit policy details, click Go to selected Policy icon. The Policy tab has the following fields.

Field Description
Name The name of the policy.
Type The type of policy associated with the activity. The Send HTTP Request activity can support the Basic Credential Mapping policy.
Description A description of the policy.