15.14 EXECUTE_WEB_SOURCE Procedure
This procedure executes a web source operation based on module name, operation and URL pattern (if required). Use the t_parameters array to pass in values for declared web source parameters. Web Source invocation is done based on metadata defined in Shared Components.
Syntax
procedure execute_web_source (
p_module_static_id in varchar2,
p_operation in varchar2,
p_url_pattern in varchar2 default null,
p_parameters in out t_parameters );Parameters
Table 15-12 EXECUTE_WEB_SOURCE Procedure Parameters
| Parameter | Description |
|---|---|
|
|
Static ID of the web source module. |
|
|
Name of the operation, e.g. POST, GET, DELETE. |
|
|
If multiple operations with the same name exist, specify the URL pattern, as defined in Shared Components, to identify the web source operation. |
|
|
Parameter values to pass to the external web source. Note that HTTP Headers, URL Patterns and other parameters being passed to a Web Source Module are typically strings. Oracle recommends to explicitly pass all values to |
| Returns | n/a |
|
|
Array with |
Example
This example assumes a REST service being created on the EMP table using ORDS and the "Auto-REST" feature (ORDS.ENABLE_OBJECT). Then a Web Source Module for this REST service is being created in Shared Components as "ORDS EMP".
The POST operation has the following "Request Body Template" defined:{"empno": "#EMPNO#", "ename": "#ENAME#", "job": "#JOB#", "sal": #SAL#}
Parameters are defined as follows:
| Name | Direction | Type |
|---|---|---|
|
|
IN |
Request Body |
|
|
IN |
Request Body |
|
|
IN |
Request Body |
|
|
IN |
Request Body |
|
|
OUT |
Request Body |
|
|
IN |
HTTP Header |
PL/SQL code to invoke that web source operation looks as follows:
declare
l_params apex_exec.t_parameters;
begin
apex_exec.add_parameter( l_params, 'ENAME', :P2_ENAME );
apex_exec.add_parameter( l_params, 'EMPNO', :P2_EMPNO );
apex_exec.add_parameter( l_params, 'SAL', :P2_SAL );
apex_exec.add_parameter( l_params, 'JOB', :P2_JOB );
apex_exec.execute_web_source(
p_module_static_id => 'ORDS_EMP',
p_operation => 'POST',
p_parameters => l_params );
:P2_RESPONSE := apex_exec.get_parameter_clob(l_params,'RESPONSE');
end;Parent topic: APEX_EXEC