Missing Query Data For POST Method

Started by Sean H., March 10, 2023, 12:43:00 PM

Previous topic - Next topic

Sean H.

I'm hoping I'm just missing something small here but I have a very basic Web Service working like the below

Code (genero) Select

function f_run_webservice()

   define
      lv_status integer,
      lo_service com.HTTPServiceRequest

   call com.webServiceEngine.start()

   while true
      try
         let lv_status = 0
         let lo_service = com.webServiceEngine.getHttpServiceRequest(-1)
         display lo_service..getMethod()
         display lo_service..getURL()
         display lo_service..getURLPath()
         call f_send_response_for_testing(lo_service)
      catch
         let lv_status = status
         case lv_status
            when -15565
               display "Disconnected"
            otherwise
               display "Unknown Error " || lv_status
         end case
         if lv_status != 0 then
            exit while
         end if
      end try
   end while
end function


When I perform a GET Request I get the Query String

Code (genero) Select

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


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

Code (genero) Select

POST
http://site.com/
/


How can I access the Query String for POST Requests?

Sean H.

Just noting that I am using Genero 3.10

Sean H.

Just another update, I found another way to access the data using

Code (genero) Select

display lo_service.readTextRequest()


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

Code (genero) Select

service=testPost&args%5Bkey01%5D=val01&args%5Bkey02%5D=val02&args%5Bkey03%5D=val03


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

Sean H.

Yes there is a way, I found the util.Strings.urlDecode utility, this does exactly what I need, sorry everyone