JamesBowen
19+ years progress programming and still learning.
After a security review, I'm needing to capture all the web requests that is being called by OE HTTP Client. Currently is just dumping to a file but will be eventually stored into the database.
I'm able to capture the HTTP header information, but I can find the correct method a capturing the POST form body of the request.
I'm assuming
How do I capture the form body when the content type is
Code Fragment:
This is what I'm able to capture:
Error:
I'm able to capture the HTTP header information, but I can find the correct method a capturing the POST form body of the request.
I'm assuming
RequestObj:Entity
contains the form body content? ¯\_(ツ)_/¯ How do I capture the form body when the content type is
application/x-www-form-urlencoded
?Code Fragment:
C#:
numHeaders = RequestObj:GetHeaders(OUTPUT HTTPHeaderTX ).
PUT STREAM sHTTPDump UNFORMATTED SUBSTITUTE("&1 &2 &3", RequestObj:method, RequestObj:URI:RelativeURI , RequestObj:Version) SKIP.
DO iHeaderIndex = 1 TO numHeaders:
PUT STREAM sHTTPDump UNFORMATTED HTTPHeaderTX[iHeaderIndex]:ToString() SKIP.
DELETE OBJECT HTTPHeaderTX[iHeaderIndex].
END.
PUT STREAM sHTTPDump UNFORMATTED SKIP(1).
OUTPUT stream sHTTPDump Close. // Important! Close the stream
DEFINE VARIABLE HTMLFormPOST AS LONGCHAR NO-UNDO.
HTMLFormPOST = CAST(RequestObj:Entity, OpenEdge.Core.String):value. // <----- Failing here
This is what I'm able to capture:
HTTP:
POST /gateway/oauth/token HTTP/1.1
Accept: */*
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Length: 215
Content-Type: application/x-www-form-urlencoded
Host: api.somehostserver.com
User-Agent: OpenEdge-HttpClient/0.7.0 (WIN32/64) OpenEdge/12.8.6.0.1236 Lib-ABLSockets/0.7.0
Error:
Invalid cast from OpenEdge.Core.Collections.StringStringMap to OpenEdge.Core.String. (12869) (12869)