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!

How to get response from web-service call in apex 4.2

Sruthi TamiriApr 21 2016 — edited Apr 27 2016

Hi Team,

    In our application we have a restful web service call, once hit this web service API call, we need to get response and i have to assign that response to variable based on that response we will display report accordingly.

1. When i click on Submit button from front end application, below web service API will be invoked below procedure as shown below

2. When we hit this i need to get orderid as response from web service API and then i need to assign that to variable like P1_ORDERID.

PROCEDURE P_REST_API_CLOB               (PI_EMPID        IN     NUMBER,                                        

                                         PI_EMPNAME      IN     VARCHAR2,                                        

                                         PO_ORDERID      OUT     NUMBER )

   IS

      v_clob         CLOB;

      v_clob_val     CLOB;

      v_status       NUMBER;

      v_start_time   DATE;

      v_end_time     DATE;

      v_order_info   VARCHAR2 (32657);

   BEGIN

      v_status := 0;

      apex_web_service.g_request_headers(1).name := 'Content-type'; 

      apex_web_service.g_request_headers(1).value := 'Application/xml';

     

      v_start_time := SYSDATE;   

      v_clob_val :=

            '<?xml version="1.0"?>

                   <ROWSET>

                       <APPLICATION>Students Employee</APPLICATION>

  <ROW>'

  || '<PO_ORDERID>'

  || PO_ORDERID

  || '</PO_ORDERID>'

  || '<PI_EMPID>'

  || PI_EMPID

  || '</PI_EMPID>'        

  || '</ROW>

                    </ROWSET>';

      v_clob :=

         APEX_WEB_SERVICE.make_rest_request (

            p_url           => 'http://10.201.178.77:7081/RESTfulWebService/Post3Clob',           

            p_http_method   => 'POST',

            p_body          => v_clob_val);

      v_end_time := SYSDATE;

   EXCEPTION

      WHEN OTHERS

      THEN

         v_status := 1;

         p_add_audit_log (emp.SEQ_AUDIT_LOG_ID.NEXTVAL,

                          'P_REST_API_CLOB',

                          'INVOKE_OTE_PI',

                          'O',

                          --NULL,

                          v_start_time,

                          v_status,

                          SQLCODE,

                          v_order_info,

                          SUBSTR (SQLERRM, 1, 120),

                          v_end_time);

   END P_REST_API_CLOB;

Regards,

Sruthitamiri

This post has been answered by Pavel_p on Apr 25 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 25 2016
Added on Apr 21 2016
25 comments
4,112 views