Best way of setting request stream property from BPL?
I have BPL BP and BO.
To call BO I need to populate the stream property of the request message.
What's the best way to do it?
Comments
Hello,
You have a stream property which is a part of the request message that you pass to a BO.
Please be more specific with what exactly do you want to do with that stream ? (
for example:create a file, use it with rest, use it with SQL, iterate on a json/xml, store in db etc.).
Then we can help you.
It's a %GlobalCharacter stream.
In BPL I need to create it and write a few lines inside before sending it to BO.
Hello,\
You may find documentation on how to work with streams here:
https://docs.intersystems.com/iris20191/csp/docbook/DocBook.UI.Page.cls?KEY=GOBJ_propstream
in BPL you can add a "code" element where you can create and populate your stream with data,. or you can add a "call" element to call a classmethod where you implement the code.
For example: to create a stream and write some data into it :
(if you need to have this stream data vailable for other components of the BPL it is best to use a %context property for it)
set stream = ##class(%Stream.GlobalCharacter).%New()
do stream.Write("some text")
do stream.Write(%request.anyproperty)
do stream.Write(%context.anyproperty)
in your request / response messages to pass to BO you will have to add a stream property :
Property MyProp As %Stream.GlobalCharacter;