Integration Server 11.1 | Built-In Services Reference Guide | Flow Folder | Summary of Elements in this Folder | pub.flow:setHTTPResponse
 
pub.flow:setHTTPResponse
WmPublic. Sets the HTTP response information to be returned by Integration Server to a client.
Input Parameters
httpResponse
Document. Optional. Contains the HTTP response to be returned by Integration Server to the client.
headers
Document List. Optional. Contains the header fields to set. Specify the following for each header that you want to set.
Key
Description
fieldName
String. Name of the header field to set.
fieldValue
String. Value of the header field to set.
responseCode
String. Optional. HTTP status code to be returned to the client.
The response codes and phrases are defined in https://tools.ietf.org/html/rfc7231#section-6. If you provide a value for responseCode that is not listed in RFC 7321, Section 6, you must also provide a value for reasonPhrase.
reasonPhrase
String. Optional. HTTP reason phrase to be returned to the client. If no reason phrase is provided, the default reason phrase associated with responseCode is used.
responseString
String. Optional. Response to be returned to the client, specified as a string.
responseBytes
byte[ ]. Optional. Response to be returned to the client, specified as a byte array.
responseStream
java.io.InputStream. Optional. Response to be returned to the client, specified as an InputStream.
responseStreamTransferEncoding
String. Optional. When set to chunked, Integration Server uses chunked transfer encoding for the response and includes the Transfer-Encoding: chunked response header. Using this parameter lets you avoid OutOfMemoryExceptions when using large responseStreams.
This parameter is used by Integration Server only if responseStream is not null. This parameter has no default value. To use it, set it to chunked.
If responseStream is not null, and this variable is not set or is set to a value other than chunked, Integration Server reads the entire responseStream to calculate the content length.
contentType
String. Optional. MIME type of the response data. By default, the server's response will match the MIME type of the request. This behavior can be overridden by using the contentType parameter.
Note:
If you explicitly set this value with Designer, you will see two choices: text/XML and text/HTML. You are not limited to these two values. Select one of these or provide a new value.
encoding
String. Optional. Character set in which the response is encoded.
Output Parameters
None.
Usage Notes
The pub.flow:setHTTPResponse service replaces the following deprecated services:
*pub.flow:setResponseCode
*pub.flow:setResponse
*pub.flow:setResponse2
*pub.flow:setResponseHeader
*pub.flow:setResponseHeaders
Use the pub.flow:setHTTPResponse service to customize an HTTP response from Integration Server. For example, when a HTTP request is successful, the server responds with 200 OK. In this response, 200 is the response code and OK is the reason phrase. However, if you need a custom reason phrase for the response code, select the responseCode parameter as 200, and provide the custom phrase in the reasonPhrase parameter of the service.
*The following header fields cannot be set using the pub.flow:setHTTPResponse service:
*Allow
*Connection
*Content-Length
*WWW-Authenticate
*Upgrade
*If you set the value of the Set-Cookie header and include the SameSite attribute using this service, then Integration Server ignores the value of the watt.server.http.header.sameSite parameter.
*You can specify the Content-Type header either using the fieldName and fieldValue keys in the headers parameter, or using the contentType parameter, but not both.
*When providing a responseCode, it is optional to include a reasonPhrase if the responseCode is selected from the standard list of HTTP response codes. For a custom responseCode, a reasonPhrase is mandatory. Specifying a reasonPhrase without a responseCode results in an error.
*When you invoke pub.flow:setHTTPResponse from Designer and set the responseCode input parameter to 204, the Results view in the Service Development perspective will be empty. This is because an HTTP response code of 204 indicates to the client that there is no content in the response. For Designer, this means there is no output pipeline to display when the service completes.
*Specify either responseString, responseBytes, or responseStream, but not all. If you specify all, the service uses responseString and ignores others. responseBytes takes precedence if both responseString and responseBytes are specified.
*When using the responseString, responseBytes, or responseStream parameters, you can provide the contentType or encoding parameters. However, the responseStreamTransferEncoding parameter is meant for use with the responseStream parameter only.