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!

Not able to POST data through RESTFul Service

devlarryJan 1 2020 — edited Jan 7 2020

I have an application on a local Oracle XE database that the user fills in a form and saves it locally. Then when they are back on the Internet they upload the data via a dblink to the server. I have been playing with using RESTFul services and so far have improved part of our process with pulling data via a REST call. I am going with REST services as we have a requirement to change passwords every 90 days on the dblinks and it is hard to change the dblinks for the people in the field. By using the REST service I don't have to connect with the people and change out the dblink over Skype. I found a blog that does CRUD over REST. I have been following his examples but I am getting an error when trying to post the new data via a REST call. I moved the process to a dynamic action hoping to get more information from debug but I have run into a brick wall. I don't know what else to do. The error is: Ajax call returned server error ORA-20999: Web Source returned an HTTP error: HTTP 400: Bad request for Execute PL/SQL Code. The process returned the same error.

The code for the process/dynamic action is:

declare

l\_parameters apex\_exec.t\_parameters;

begin

apex_exec.add_parameter( p_parameters => l_parameters, p_name => 'INSPECTOR', p_value => :P200_INSPECTOR );

apex_exec.add_parameter( p_parameters => l_parameters, p_name => 'INSP_DATE', p_value => :P200_INSP_DATE );

apex_exec.add_parameter( p_parameters => l_parameters, p_name => 'INVENTNO', p_value => :P200_INVENTNO );

apex_exec.add_parameter( p_parameters => l_parameters, p_name => 'WH_LAT', p_value => :P200_WH_LAT );

apex_exec.add_parameter( p_parameters => l_parameters, p_name => 'WH_LONG', p_value => :P200_WH_LONG );

apex_exec.execute_web_source(

p\_module\_static\_id => 'WELL\_TEMP',

p\_operation        => 'POST',

p\_parameters       => l\_parameters );

:P200_RESPONSE := apex_exec.get_parameter_clob(l_parameters,'RESPONSE');

end;

When I debug the post I can see the data

Request body is: {"inspector":Rick Davis,"insp_date":12\/20\/2019,"inventno":OS5800000,"wh_lat":36.707688,"wh_long":-96.142757}

In the WELL_TEMP web services module:

post.png

I have each field listed as type Request / Reponse Body and direction IN. I also added the Content-Type, HTTP Header, In, application/json as the example stated.

parms.png

rest1.png

rest2.png

rest3.png

My Oracle environment is:

Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production

APEX Product Build 18.2.0.00.12

APEX_LISTENER_VERSION 3.0.9.348.07.16

I have googled the Internet and searched the forum but have now found and solutions or

Any thoughts on what I am doing wrong? Or how to figure out what the Bad Request is?

Lawrence

Comments
Post Details
Added on Jan 1 2020
5 comments
1,199 views