Question

Make REST call synchronous

  • 15 February 2023
  • 5 replies
  • 268 views

Badge +2

In the Technical documentation for IFS10 is i written

By default REST Sender message flow is asynchronous. To make it synchronous you should set it from the PL/SQL logic.

How do you set the message to synchronous in the pl/sql logic

Can anyone provide me with an example?


5 replies

Userlevel 4
Badge +9

I did it several times with

 

   Plsql_Rest_Sender_API.Call_Rest_EndPoint3(
      rest_service_     => NULL,
      receiver_         => '<any_name_for_usage_in_routing_rule>',
      xml_              => json_,
      url_params_       => url_params_,
      http_method_      => 'GET',
      http_req_headers_ => 'Content-Type: application/json',
      query_parameters_ => query_params_);
 

Variable ‘json_’ should be a CLOB containing the json document you would like to transfer. Variables ‘url_params_’ and ‘query_params_’ can be set as in asynchronous REST calls.

 

Works fine.

 

Best regards

Heinz

Badge +2

Hi Heinz!

I can’t get your exampel to work for my case

What I’m trying to achive is to get a json string from the customer and with the callback function do updates in IFS.

I do receive the jsonstring into IFSConnect, but it lands to late. Once it’s in connect the Callback function is alredy called but ther is no data to be found at that point. I want the rest call to wait for the GET to be commited before it executes. Do you or anyone have an ide on how to solve this

 

    Plsql_rest_sender_API.Call_Rest_EndPoint_Empty_Body2(rest_service_ => 'GET_SCALE_PART',
                                                             url_params_ => Url_params,
                                                             callback_func_ => 'C_Integration_Util_Api.REST_callback_Part',
                                                             http_method_ => 'GET',
                                                             http_req_headers_ => 'Content-Type:application/json',                                                      
                                                             key_ref_ => client_sys.get_key_reference('','articleId',mtyp_,'contract',contract_),
                                                             accepted_res_codes_ =>'200');

This is how the routing rule is set up in IFS

 

Userlevel 4
Badge +9

Hi,

that’s a differnt approach. If you use a callback function it won’t be synchronously.

Best regards

Heinz

Userlevel 7
Badge +21

Hi @katase 

 

Set incld_resp_info_ => TRUE when calling Plsql_rest_sender_API.Call_Rest_EndPoint_Empty_Body2 to include the response inside your callback function.

 

Regards,

Damith

Badge +2

 

Hi,

that’s a differnt approach. If you use a callback function it won’t be synchronously.

Best regards

Heinz

How will I then get the call back function to be called without having to use a scheduled task to fetch the data from connectivity to enable the update in IFS?

There is a clob as inparameter to the callback function but it’s not containing the json string. The json data from the customer is updated in tabel fndcn_message_body_tab.

Is there a way to have the data returned in callback funktion? That would solve my problem.  They way it’s set up is an example that I found in IFS Community

 

Reply