Question
· Jan 23, 2023

How to read http json response from service

Hello

i'm trying to read http json response from service. The response size  res.HttpResponse.Data.Size =  19610854 

ClassMethod getData(pCode,pDate, pGlb) As %Status
{

    Do res.Get("TestService/getData?dateTo="_$ZDate(pDate,3))
    Set stat=res.HttpResponse.StatusCode
    Do res.HttpResponse.Data.Rewind() 
    Set httpResponse=res.HttpResponse.Data.Read(res.HttpResponse.Data.Size,.sc)
    Set dynObj = [].%FromJSON(httpResponse)
    Set iter = dynObj.Stmt.%GetIterator()
    While iter.%GetNext(.key, .value){
        Set @pGlb@(item)=$ListBuild(SomeField1,SomeField1)
    }

}

when trying to get data from global :

Set result=##class(test.Data).getData("PM",pDate,$Name(^||Data))
w ^||owData -  Error <UNDEFINED>

I thing the problem in that the size of httpResponse is too big/

how I can read such http response ?

Product version: IRIS 2020.3
$ZV: IRIS for Windows (x86-64) 2020.1.3
Discussion (2)0
Log in or sign up to continue