24.19 EXECUTE_WEB_SOURCE Procedure (Deprecated)

Note:

This procedure is deprecated and will be removed in a future release. Use execute_rest_source instead.

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 24-14 EXECUTE_WEB_SOURCE Procedure Parameters

Parameter Description

p_module_static_id

Static ID of the web source module.

p_operation

Name of the operation (for example, POST, GET, DELETE).

p_url_pattern

If multiple operations with the same name exist, specify the URL pattern, as defined in Shared Components, to identify the web source operation.

p_parameters

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 VARCHAR2 before adding to the T_PARAMETERS array.

Returns n/a

p_parameters

Array with OUT parameter values, received from the web source module.

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 Default Value

EMPNO

IN

Request Body

n/a

ENAME

IN

Request Body

n/a

SAL

IN

Request Body

n/a

JOB

IN

Request Body

n/a

RESPONSE

OUT

Request Body

n/a

Content-Type

IN

HTTP Header

application/json

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;