Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

APEX_WEB_SERVICE.MAKE_REST_REQUEST POST method p_parm_names&values

Pavel_pSep 5 2018 — edited Sep 6 2018

Hello,

I tried to invoke the page here https://www.w3schools.com/tags/att_form_method.asp using APEX_WEB_SERVICE.MAKE_REST_REQUEST (both GET and POST methods). First time specifying parameters using p_parm_names and p_parm_values, second time were parameters sent directly in URL as name-value pairs (i.e. ?param1_name=param1_value&param2_name=param2_value).

The page setup is two items with input parameters that are being sent to the server and two buttons, one produces SUBMIT_P_PARAMS request, the other one something else.

For the GET method the code looks like this:

declare

  l_parm_names  apex_application_global.vc_arr2;

  l_parm_values apex_application_global.vc_arr2;

  l_resp        clob;

begin

  l_parm_names(1) := 'fname';

  l_parm_values(1) := :p1_fname;

  l_parm_names(2) := 'lname';

  l_parm_values(2) := :p1_lname;

  if :request = 'SUBMIT_P_PARAMS' then --first time specify parameters using p_parm_names and p_parm_values

      l_resp := apex_web_service.make_rest_request(p_url => 'https://www.w3schools.com/action_page.php',

          p_http_method => 'GET',

          p_parm_name => l_parm_names,

          p_parm_value => l_parm_values

      );

  else --second time directly in URL

      l_resp := apex_web_service.make_rest_request(p_url => 'https://www.w3schools.com/action_page.php?fname=' || :p1_fname || '&lname=' || :p1_lname,

          p_http_method => 'GET'

      );

  end if;

  --in both cases we're getting pretty much the same response

 

  :p1_response := 'Request: ' || :request || chr(10) || l_resp ;

end;

In both cases the response is the same as expected.

However for the POST method (very same code, just the method is changed to POST) the result is completely different as if the page is invoked with parameters specified using p_parm_names&values, it looks like nothing is being sent (if parameters are specified in URL, the response is as expected) which makes me think that p_parm_names and p_parm_values are ignored for other methods than GET.

I created a showcase on apex.oracle.com

ws: pp_test

user: test

pwd: test

Application 67928 - REST_post_params

This is one of the quite rare occasions when I would really appreciate if APEX packages were not wrapped to see what exactly is happening inside... Please, @"Carsten Czarski-Oracle", could you take a look at it and explain why this is happening and eventually confirm my assumption that p_parm_names&values are being ignored for the POST method (or maybe other then GET) is correct?

Thanks a lot,

Pavel

This post has been answered by Carsten Czarski-Oracle on Sep 6 2018
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 4 2018
Added on Sep 5 2018
2 comments
11,797 views