WSHeader
Defines custom headers in the request and response of Web service functions.
Syntax
WSHeader
Where:
WSHeader
is defined in an ATTRIBUTE()
clause in an input
parameter or return value of the function.
Usage
You use the WSHeader
attribute to define a custom header. It is valid to set
this in input parameters and in return values.
Example WSHeader in input parameter
PUBLIC FUNCTION Add(
a INTEGER ATTRIBUTE(WSHeader),
b INTEGER ATTRIBUTE(WSQuery) )
ATTRIBUTES( WSGet )
RETURNS (INTEGER)
# ... function code ...
RETURN a + b
END FUNCTION
Your client application must set this custom header and value.
Example WSHeader in return value
PUBLIC FUNCTION help()
ATTRIBUTES (WSGet)
RETURNS (INTEGER ATTRIBUTE(WSHeader),
STRING)
# ... function code ...
RETURN 3, "hello world"
END FUNCTION
In the response, you define a custom header in the RETURNS
clause of your
function.
In the HTTP output the integer ("3") is returned in the header and the string ("hello world" ) is returned in the response body.
Unnamed parameters and return values are given default names, "rv0", "rv1", etc., at runtime. You
can change default header naming via the WSName
attribute, for example with:
ATTRIBUTE(WSHeader, WSName="MyHeader")