[Progress Communities] [Progress OpenEdge ABL] Forum Post: Missing something with IWebRequest:GetPathParameter() - WebService with WebHandler

Status
Not open for further replies.
S

slacroixak

Guest
OE 11.7.5 What am I missing with the GetPathParameter method? The doc says about GetPathParameter() : Get a parameter from the URI path if URI template matching was used. I test it with a sample WebService with a WebHandler that does the following in the HandleGet() method: [...] DEFINE VARIABLE oBody AS OpenEdge.Core.String NO-UNDO. DEFINE VARIABLE cwhere AS CHARACTER NO-UNDO. DEFINE VARIABLE curi AS CHARACTER NO-UNDO. DEFINE VARIABLE curiTemplate AS CHARACTER NO-UNDO. ASSIGN oResponse = NEW OpenEdge.Web.WebResponse() oResponse:StatusCode = INTEGER(StatusCodeEnum:OK) cwhere = poRequest:GetPathParameter("pcwhere") curi = poRequest:URI:toString(). oBody = NEW OpenEdge.Core.String(SUBSTITUTE ( 'Hello World~n pcwhere=&1~n uri=&2 ~n UriTemplate=&3' , QUOTER( cwhere ) , QUOTER(curi) , QUOTER(curiTemplate))). ASSIGN oResponse:Entity = oBody oResponse:ContentType = 'text/plain' /* HTTP messages require a content type */ oResponse:ContentLength = oBody:Size. /* ContentLength is good too */ [...] This request with Postman : localhost:8810/AKQWeb/web/TestGetParam?pcwhere=bladibla Results in the following response : Hello World pcwhere="" uri=" localhost:8810/.../TestGetParam UriTemplate="/TestGetParam" Indeed, I was expecting 'bladibla' for pcwhere. Because of that, I have to make my own GetPathParameter() method What am I missing ?

Continue reading...
 
Status
Not open for further replies.
Top