Download a large object in the response body
This example demonstrates how to send a large object in the message response body.
To transfer a large object (LOB) to a client, specify a return parameter using a TEXT or BYTE data type. The large object is returned in the response body.
Example: downloading a TEXT object
In this example:
- The
TEXTvariable (t) is created to hold the file content and is located in memory. - The
readFile()method reads the content of the text file (file3.txt) into theTEXTvariable (t). - The
TEXTvariable (t) is transferred in the message body. - The
INTEGERvariable, defined as a return parameter with the WSHeader attribute, is transferred in the response header.
PUBLIC FUNCTION help3()
ATTRIBUTES (WSGet,
WSDescription="Download text to the client in a TEXT object",
WSPath="/help/file3")
RETURNS ( INTEGER ATTRIBUTE(WSHeader), TEXT )
DEFINE t TEXT
LOCATE t IN MEMORY
CALL t.readFile("file3.txt")
RETURN 3, t
END FUNCTION
rv0") at runtime. Use the WSName attribute to rename the
header.RETURNS (INTEGER ATTRIBUTE(WSHeader, WSName="MyHeader"), TEXT)