We are designing a REST web service server application. So far so good following the WS* field attributes. We've been using a combination of WSPath, WSParam, and WSHeader go the the parameters we need.
What we find at the moment is that our web service "handler" function parameters is getting quite verbose and repetitive, some would even say messy.
PUBLIC FUNCTION file_attach_post (
request T_FILE_ATTACH_REQUEST,
client_id STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-client-id"),
client_token STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-client-token"),
machine_id STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-machine-id"),
user_id STRING ATTRIBUTE(WSHeader, WSOptional, WSName = "X-VTM-user-id")
)
For us, most of the WSHeader fields are for auditing purposes, they are not actual parameters for the web service call. And for every web service we define, we need to add the same header information. This is unnecessary repetitive, and at the same time, when the "client" code is generated from the openapi.json, these fields become parameters on the other side as well. Overall, not the cleanest way.
We look further at this and we see that the documentation describes another way of getting the HTTPHeader information using WSContext:
https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_gws_restful_high_level_handling_http_headers.htmlI would like to remove those WSHeader variables from our function and access them through a different way. However, we find that the context DICTIONARY only provide access to a limited set of keys (Media, BaseURL, Scope, and Content-Type) -- far from what we were looking for. We do not see our X-VTM-* variables, what are we missing here?
We also tried using com.WebServiceEngine.GetHTTPServiceRequest() function to get the HTTPServiceRequest, but that seems to be only used for low-level REST service.
So question: Is there a way I can access arbitrary HTTP headers in a high-level REST framework design that I'm not aware of?