Four Js Development Tools Forum

Discussions by product => GWS => Topic started by: Sean H. on March 10, 2023, 12:43:00 pm



Title: Missing Query Data For POST Method
Post by: Sean H. on March 10, 2023, 12:43:00 pm
I'm hoping I'm just missing something small here but I have a very basic Web Service working like the below

Code
  1. function f_run_webservice()
  2.  
  3.   define
  4.      lv_status integer,
  5.      lo_service com.HTTPServiceRequest
  6.  
  7.   call com.webServiceEngine.start()
  8.  
  9.   while true
  10.      try
  11.         let lv_status = 0
  12.         let lo_service = com.webServiceEngine.getHttpServiceRequest(-1)
  13.         display lo_service..getMethod()
  14.         display lo_service..getURL()
  15.         display lo_service..getURLPath()
  16.         call f_send_response_for_testing(lo_service)
  17.      catch
  18.         let lv_status = status
  19.         case lv_status
  20.            when -15565
  21.               display "Disconnected"
  22.            otherwise
  23.               display "Unknown Error " || lv_status
  24.         end case
  25.         if lv_status != 0 then
  26.            exit while
  27.         end if
  28.      end try
  29.   end while
  30. end function
  31.  

When I perform a GET Request I get the Query String

Code
  1. GET
  2. http://site.com/?service=testGet&args[key01]=val01&args[key02]=val02&args[key03]=val03
  3. /
  4.  

When I perform a Post Request (with the same arguments as the previous GET Request) I seem to be missing the Query String

Code
  1. POST
  2. http://site.com/
  3. /
  4.  

How can I access the Query String for POST Requests?


Title: Re: Missing Query Data For POST Method
Post by: Sean H. on March 10, 2023, 12:47:24 pm
Just noting that I am using Genero 3.10


Title: Re: Missing Query Data For POST Method
Post by: Sean H. on March 10, 2023, 01:20:32 pm
Just another update, I found another way to access the data using

Code
  1. display lo_service.readTextRequest()
  2.  

This looks perfect but it has the data in an encoded format

Code
  1. service=testPost&args%5Bkey01%5D=val01&args%5Bkey02%5D=val02&args%5Bkey03%5D=val03
  2.  

Is there a way to decode the format into the similar format as in the lo_service.getURLPath()?

Decode
service=testPost&args%5Bkey01%5D=val01&args%5Bkey02%5D=val02&args%5Bkey03%5D=val03
Into
service=testGet&args[key01]=val01&args[key02]=val02&args[key03]=val03


Title: Re: Missing Query Data For POST Method
Post by: Sean H. on March 10, 2023, 01:33:31 pm
Yes there is a way, I found the util.Strings.urlDecode utility, this does exactly what I need, sorry everyone