Question
Rochdi Badis · May 8

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)?

 

Method OnProcessInput(pInput As %CharacterStream, Output pOutput As %CharacterStream) As %Status
{
   Set pOutput=##class(%GlobalCharacterStream).%New()
   cnt=$O(^NQLIn(""),-1)
    ^NQLIn(cnt+1)=pInput
     res= ##Class(MSDS.Common.Task.NQLINPostProcess).ProcessInput(cnt)
     Do pOutput.WriteLine("202")
     Do pOutput.Flush()
    Quit $$$OK
}

ClassMethod ProcessInput(Count As %String) As %String
{
set status=$$$OK
set HTTPURL = "unknown"
set start = $ZDATETIME($h,-2)
try{
Set pInput=##class(%GlobalCharacterStream).%New()
pInput=^NQLIn(Count)
     Set HTTPURL = $ZCVT($G(pInput.Attributes("URL")),"U")
    
 

 

Thanks

Product version: Ensemble 2014.1
0
0 65
Discussion (2)1
Log in or sign up to continue

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