Question
Alexander Grishkan · Mar 8, 2017

HTTP request payload

I am sending an HTTP request to cache class:

s rObj=##class(%Net.HttpRequest).%New()
s rObj.Server="www.xyz.com"
s rObj.Https=1
s rObj.SSLConfiguration="xyz"
s rObj.ContentType="application/json"
d rObj.EntityBody.Write("payload in json format")

s sc=rObj.Post("/csp/ns/xyz.cls")

The request gets to the OnPreHTTP class method 

Class xyz Extends %CSP.Page [ ProcedureBlock ]
{

ClassMethod OnPreHTTP() As %Boolean
{
    q 1

}

}

The question is how to retrieve the request payload in the OnPreHTTP method.

0
0 975
Discussion (4)2
Log in or sign up to continue

%request.Content is a stream with all JSON payload.

If you want to process HTTP requests, you can use REST API.

Thank you Eduard,

The %request.Content it is. I don't have REST API in my Cache - 2010.2.7.

You should consider upgrading, 2010.2.7 is long since past its age limit.

I know Fabian. We're in the process of upgrading but for the short while I needed  the solution.

Thanks.