Handling %GlobalCharacterStream in a Production Service
Hi Guys,
I've a Production Service that receives a CharacterStream and save it in a Global, then a second classmethod that pick up that CharacterStream from the global and process it, but for some reason it fails when i comes Set HTTPURL = $ZCVT($G(pInput.Attributes("URL")),"U") which error saying "INVALID OREF", as I checked it seems that pInput is has a CharacterStream but not sure why is says invalid Object ref (see attached)?
{
Set pOutput=##class(%GlobalCharacterStream).%New()
S cnt=$O(^NQLIn(""),-1)
S ^NQLIn(cnt+1)=pInput
S res= ##Class(MSDS.Common.Task.NQLINPostProcess).ProcessInput(cnt)
Do pOutput.WriteLine("202")
Do pOutput.Flush()
Quit $$$OK
}
{
set status=$$$OK
set HTTPURL = "unknown"
set start = $ZDATETIME($h,-2)
try{
Set pInput=##class(%GlobalCharacterStream).%New()
S pInput=^NQLIn(Count)
Set HTTPURL = $ZCVT($G(pInput.Attributes("URL")),"U")
Thanks
The input variable pInput is an object(reference). You can't save OREFs in a global!
Think about OREFs as memory location (or, if you "speak" C, as a pointer). Trying to save it in a global is the same as saving a C pointer into a file for a later use... Won't work either
Thanks