uCosminexus Service Platform, Overview
This section describes how to process the response message from a business process returned to HTTP reception as HTTP response.
HTTP response returning the response to HTTP client is partitioned in the following manner and it is processed in HTTP reception:
HTTP response status line is output in the following format:
[HTTP version#1][Blank][Status code#2][Blank][Reason phrase] |
All header information specified in HTTP reception is set in HTTP response header.
HTTP response header process is described here.
Content-Type header and charset attribute used in HTTP response header differ according to the following conditions:
Table 2-19 Content-Type and charset used in HTTP response header (if response message format (for header variable) is set)
Setting item | If content-type element exists in response message#1 | If content-type element exists in http-header element of the response message | If content-type element and charset attribute do not exist in response message | ||
---|---|---|---|---|---|
If charset attribute exists in content-type element | If charset attribute does not exist in content-type element | If charset attribute exists in http-header element | If charset attribute does not exist in http-header element | ||
Content-Type header | Value of content-type element of response message is valid. | Value of content-type element of response message is valid. | Value of content-type element of http-header element of response message is valid.#3 | Value of content-type element of http-header element of response message is valid.#3 | "text/xml" is set. |
charset attribute | Value of charset attribute of content-type element of response message is valid.#2 | Specified value of HTTP reception definition file is valid. | Value of charset attribute of http-header element of response message is valid.#3 | Specified value of HTTP reception definition file is valid. | Specified value of HTTP reception definition file is valid. |
Table 2-20 Content-Type header and charset attribute used in HTTP response header (if response message format (for header variable) is not set)
Setting item | If HTTP response header definition file exists | If HTTP response header definition file does not exist | ||
---|---|---|---|---|
If content-type key exists in HTTP response header definition file | If content-type key does not exist in HTTP response header definition file | |||
charset attribute exists in specified value of content-type key | charset attribute does not exist in the specified value of content-type key | charset key does not exist in HTTP response header definition file | ||
Content-Type header | Specified value of content-type key is valid.# | Specified value of content-type key is valid.# | "text/xml" is set. | "text/xml" is set. |
charset attribute | Value of charset attribute existing in the specified value of content-type key is valid.# | Specified value of HTTP reception definition file is valid. | Specified value of HTTP reception definition file is valid. | Specified value of HTTP reception definition file is valid. |
Table 2-21 Content-Type header and charset attribute used in HTTP response header
Setting item | If content-type element exists under file element of response message | If content-type element does not exist under file element of response message | |
---|---|---|---|
If charset attribute exists in content-type element under file element | If charset attribute does not exist in content-type element under file element | ||
Content-Type header | Value of content-type element under file element of response message is valid. | Value of content-type element under file element of response message is valid. | Not set. |
charset attribute | Value of charset attribute of content-type element under file element of response message is valid. | Not set. | Not set. |
For Content-Disposition header of HTTP response, the following values are set according to HTTP response part classification and the number of data items. If files are not downloaded, Content-Disposition header is not set in HTTP response.
Table 2-22 Value of Content-Disposition header set by HTTP reception
Part classification | Number of data items | Setting location | Value of Content-Disposition header | name attribute | filename attribute |
---|---|---|---|---|---|
Single part type | 1 file | HTTP response header | attachment# | Not set. | Value of filename element of response message (header) |
Multi-part type | 1 file + text data | Header of each part of HTTP response | form-data | Value of part ID element of response message (header) | |
Multiple files |
If http-header element of response message (header) contains content-disposition element, the value is ignored. If Content-Disposition header is specified in HTTP response header definition file, the value is valid.
If only text data returns in HTTP response, you can specify whether to generate Content-Length header showing contents length in HTTP reception by using httprecp.response.generate.content-length property of HTTP reception definition file. You can specify the character code to be used while calculating contents length in httprecp.http.charset property of HTTP reception definition file.
For details on HTTP reception definition file, see "HTTP reception definition file" in "Service Platform Reference Guide" .
The following table describes the value of Content-Length header passed to HTTP client when specification exists and does not exist in HTTP reception definition file:
Table 2-23 Content-Length header passed to HTTP client
Value of httprecp.response.generate.content-length property | Existence of specification of content-length element of http-header element in content-length key or response message (header) of HTTP response header definition file | Value of Content-Length header passed to HTTP client |
---|---|---|
true | Y | Value specified in HTTP response definition file or response message (header) is overwritten by data length calculated by HTTP reception. |
N | ||
false | Y | Data length specified in HTTP response header definition file or response message (header) is set in Content-Length header.# |
N | Content-Length header is not passed to HTTP client. |
Downloading of more than 1 file is invalid even option of sending Content-Length header to the client is set. Even if the file is not downloaded, Content-Length header is not set even if the setting is performed to ignore the response message (body) in ignore-bodymsg element of the response message (header) or httprecp.response.ignore-bodymsg property of HTTP reception definition file.
This section describes HTTP response body process for each data format sent to HTTP client.
After processing of the business process is completed, the response message (body) variable returns to HTTP reception as XML type character string and is set in HTTP response body as text data. While setting, encoding occurs according to the specified character code.
If a system exception occurs, error message ID and message contents are set in the response message (body) element.
Text data returns only data that is the response message (body) part specified in the reply activity. Due to this, if multi-part type response is returned, text data exists in only 1 part.
You can set whether HTTP reception is to ignore (not set in HTTP response) the response message (body) received from the business process by ignore-bodymsg element of response message (header) or httprecp.response.ignore-bodymsg property of HTTP reception definition file. If both response message (header) and HTTP reception definition file are specified, specification of response message (header) is prioritized. If this element (or property) is specified and there is no file data to be downloaded, blank HTTP response body is returned to HTTP client.
To download file data, specify the name of the file to be downloaded in file element of the response message (header). The following table describes the elements specified in the response message (header) and the corresponding HTTP response header:
Table 2-24 Element specified in response message (header)
Element name specified in response message (header) | Description | Corresponding HTTP response header (header corresponding to each part in multi-part type) |
Value if omitted |
---|---|---|---|
partID | Part identifier name showing each part of multi-part type. | name attribute of Content-Disposition header | Intermediate file name specified in local-file-name element is set. Ignored even if specified if it is not multi-part type and name attribute is not provided. |
file-name | Download file name during download in HTTP client. | filename attribute of Content-Disposition header | None (filename attribute is not set). |
local-file-name | Intermediate file name to be downloaded in the working folder. If file with the specified name does not exist, error occurs. | None | Cannot be omitted. |
content-type# | Specify download file media type. | Content-Type header | None (Content-Type header is not set). |
charset | Specify download file character code. | charset attribute | None. |
You can set binary data in HTTP response body and return the response to the client by specifying binary format or optional format (any format) in the message format of HTTP reception response message.
Binary data is set in HTTP response body only if all the following conditions are met:
This section describes status codes of HTTP request and HTTP response.
The value set for status code during response differs according to response timing and type. The following table describes the status code setting value and response timing:
Table 2-25 Set status codes
Timing | Response type | Specification of status-code element in response message (header) | |
---|---|---|---|
Exists | Does not exist | ||
Before invoking business process | If error occurs in HTTP reception verification | - | HTTP reception sets status code according to error status. |
After invoking business process | In normal termination | Status code set in status-code element of response message (header) is used.#1 | 200#2 |
In fault | Status code set in status-code element of response message (header) is used.#1 | 200#3 | |
In system exception | - | Value of httprecp.system-exception.status-code property in HTTP reception definition file is valid.#4 |
The following table describes the correspondence between message ID and status code when error occurs in HTTP request and HTTP response processing:
Table 2-26 List of status codes when error occurs in request processing
Message ID | Status when error occurs | Status code |
---|---|---|
KDEC80424 | If an internal error occurs (error occurs during XML format transformation of HTTP header or HTTP body) | 500 |
KDEC80438 | If HTTP method is other than GET or POST | 405 |
KDEC80439 | If the operation name specified in URL does not match with the operation name specified in HTTP reception | 404 |
KDEC80440 | If an invalid character is specified in the query character string, HTTP body or HTTP header | 400 |
KDEC80441 | If msg key is not specified in the request parameter or if an upper case character is specified in pass-through mode | 400 |
KDEC80442 | If an error occurs in URL decoding according to the encoding specified in HTTP request header or HTTP reception definition file | 500 |
KDEC80451 | If a unique request ID cannot be generated due to one of the following factors:
|
500 |
KDEC80452 | If the root directory of the working folder specified in HCSC server runtime definition file does not exist | 500 |
KDEC80453 | If failure occurs while creating a working folder | 500 |
KDEC80454 | If multi-part type HTTP request data reception or analysis fails | 400 |
KDEC80457 | If an error occurs during output of an intermediate file | 500 |
Table 2-27 List of status codes when an error occurs in response process
Message ID | Status when an error occurs | Status code |
---|---|---|
KDEC80424 | If an internal error occurs (acquisition of HTTP response body stream fails or an exception occurs in writing value in HTTP response body) | 500 |
KDEC80443 | If an error occurs in HTTP header or HTTP body analysis during reception | 500 |
KDEC80444 | If an error occurs during response message encoding | 500 |
KDEC80445 | If the status code returned from the business process is more than 3 digits or less | 500 |
KDEC80458 | If reading of an intermediate file fails | 500 |
KDEC80459 | If failure occurs while deleting a working folder | 200 |
All Rights Reserved. Copyright (C) 2015, Hitachi, Ltd.