Skip to main content

Hi,

We have a requirement to invoke a REST API POST request to an external system under certain circumstances, and in some cases there may be many messages to send within a short period.  I’m therefore sending them as an asynch call using Plsql_Rest_Sender_API.Call_Rest_EndPoint_Json with both a callback and error function defined:

   Plsql_Rest_Sender_API.Call_Rest_EndPoint_Json( 

            rest_service_,  

            xml_,

            url_params_ => NULL,  

            callback_func_ => XXX_API.Ok_Callback',  

            http_method_ => 'POST',

            http_req_headers_ => 'X-Authorization: Bearer ' || token_,

            key_ref_   => key_ref_,

            failed_callback_fun_ => 'XXX_API.Failed_Callback',  

            accepted_res_codes_  => '200');  
 
 

The successful callback function is defined as:

PROCEDURE Ok_Callback (xml_clob_ CLOB, app_msg_id_ VARCHAR2, key_ref_ VARCHAR2)

This is all working fine but I’m having problems reliably getting the body of the successful response in the callback function.  I’ve made use of the information in 

 

and I’ve found that the response could be in seq_no 2 or 3.  Once the application message shows as finished I can see the response in the database in the MESSAGE_VALUE field of the MESSAGE_BODY table using

select application_message_id, seq_no, message_text, utl_raw.cast_to_varchar2(dbms_lob.substr(message_value,2000,1)) FROM MESSAGE_BODY

However, if I use this in the callback function it doesn’t always get the responses.  It works if the response_body is in seq_no 2, but when the response_body is in seq_no 3 the callback function only finds the entry for seq_no 1.

Is there something I need to do or something I’ve missed which will ensure that the callback function will reliably get the response body?

Any suggestions much appreciated!

Thanks,

mmck

Be the first to reply!

Reply