WSPostProcessing
Specify functions in a REST web service module that are used as postprocessing request handlers.
Syntax
WSPostProcessing = "[ wsheader ]"
- WSPostProcessing has one option,
wsheader. It is a string value setting. - When used on its own without an option, WSPostProcessing is set on a callback function for the body of the REST request.
WSPostProcessing is an attribute set on a BDL private function in a REST web
service module.
Usage
You use this attribute to specify callback functions in the REST service module that run when an
incoming REST request is executed and before the REST response is forwarded to the client. The
callback function must be one of the predefined callback functions. These functions typically
adjust the values of the response headers. The WSPostProcessing attribute applies
postprocessing callbacks to adjust the response body format, such as renaming JSON keys, normalizing
XML tags, or transforming text content.
For the predefined callback functions, go to Using preprocessing and postprocessing callbacks and Examples of callback functions.
Postprocessing callbacks can also set Context["HTTPProcessingErrorMsg"] when
returning a non-zero code; the value becomes the HTTP reason phrase. Defaulting and behavior is the
same as for preprocessing callbacks; postprocessing messages override preprocessing ones when both
fail.
PRIVATE # REST Header outgoing callback
FUNCTION HeaderPostCallback(header STRING, value STRING) ATTRIBUTES (WSPostProcessing="wsheader") RETURNS (STRING)
DISPLAY "Header:",header
DISPLAY "Value:",value
# your code here
RETURN value # new header value
END FUNCTION
Example using WSPostProcessing
For details, go to Examples of callback functions.