Greetings:
I am trying to capture the contents of the following oReq object to a LONGCHAR/CLOB etc. for logging purposes but having no luck.
Does anyone know how to accomplish this? There are no other problems I am having with this logic.
Here is how I am creating the oReq:
oReq = RequestBuilder:Build('GET', oUri)
:UsingBASicAuthentication(oCreds)
:AcceptJson()
:Request.
I tried a CAST of oReq to a JsonObject and also to a String object with no luck (both returned an INVALID HANDLE).
Thanks,
h
|
||||
Brian Maher
|
||||
Principal Engineer, Technical Support
|
||||
Progress
|
||||
14 Oak Park | Bedford, MA 01730 | USA
|
||||
|
||||
|
Brian, I appreciate your response. Thank you for that.
However, I am trying to store the Request object 'oReq' in a LONGCHAR programmatically, instead of just logging it to a file on disk.
Anyone have any thoughts on how to do that?
|
||||
Brian Maher
|
||||
Principal Engineer, Technical Support
|
||||
Progress
|
||||
14 Oak Park | Bedford, MA 01730 | USA
|
||||
|
||||
|
You can't store a request object as a longchar. it isn't a string, or at least it doesn't have a good representation as a string. It is structured data (objects). The best you could do is convert it to a JSON document and turn that into a string, but you'd have to do that yourself. There isn't a utility to convert a request object to a string directly. And you certainly can't simply cast it.
You'd have to write a data conversion method to convert the request into a string representation appropriate for whatever logging system you intend to use.
Hello, Peter. I am implementing a Request Tracker DB table that stores Request/Response as CLOB fields. For this, I need to be able to serialize the HTTPRequest object.
For requests, you can follow the approach we use to serialize requests for passing to the server: github.com/.../ABLSocketLibrary.cls .
Note that the will put the request into a ByteBucket (basically a MEMPTR). I would store a BLOB and not a CLOB since there are likely to be cases where you have null bytes in the payload (images etc).
You'll have to write your own for responses (at the moment). The easiest way might be to add data recieved event to the socket, so that you'll get the data as it comes off the socket. This is untested though so YMMV.