Skip to main content
Solved

How to grap the Application Message response?


krestensb
Sidekick (Customer)
Forum|alt.badge.img+8

Hi,

I have send out an Application Message from IFS to an external API endpoint using a HTTP connector.

I have reaced the endpoint succesfully.

The endpoint returned me back a message and IFS is showing it to med in a .txt file.

How can I access that response, and have is saved somewhere in the database?

Any help is very appreciated.

Kresten

Best answer by dsj

Elaborating the answer by @Tomas Ruderfelt , here’s what I have done in a similar scenario where I had to process the reply from an external web service in Apps9 without doing any code modification :wink:

In my scenario, I’m getting the currency rates from an external API and update IFS currencies.

1: Create an event on FNDCN_APPLICATION_MESSAGE_TAB based on STATE field

 

Event Action: remember to add proper conditions just to trigger the action only for your integration, and state = Finished

This calls another event in a background job. Reason for taking this approach is the message reply is not commit at this time so we can’t access it directly from the event action on FNDCN_APPLICATION_MESSAGE_TAB

 

Code:

declare

  event_enabled_ BOOLEAN := Event_SYS.Event_Enabled('Event','CURRENCY_UPD_EXECUTE');

  parameters_    VARCHAR2(32000);

  event_msg_     VARCHAR2(32000);

  id_            NUMBER;

begin

  IF event_enabled_ THEN

    Fnd_Session_API.Impersonate_Fnd_User(fnd_session_api.get_app_owner);

    event_msg_ := Message_SYS.Construct('CURRENCY_UPD_EXECUTE');

    Message_SYS.Add_Attribute(event_msg_,'APPLICATION_MESSAGE_ID','&NEW:APPLICATION_MESSAGE_ID');

    Client_SYS.Add_To_Attr('EVENT_LU_NAME_', 'Event', parameters_);

    Client_SYS.Add_To_Attr('EVENT_ID_','CURRENCY_UPD_EXECUTE',parameters_);

    Client_SYS.Add_To_Attr('EVENT_DATA_', event_msg_, parameters_);

  

    Transaction_SYS.Deferred_Call(id_,'EVENT_SYS.EVENT_EXECUTE','PARAMETER',parameters_,'Process cureency XML');

    Fnd_Session_API.Reset_Fnd_User;

  END IF;

end;

 

Script to create the CURRENCY_UPD_EXECUTE event:

 

BEGIN

   Event_SYS.Enable_Event('Event', 'CURRENCY_UPD_EXECUTE',

                          'Execute Currency XML',

   'APPLICATION_MESSAGE_ID/STRING^');

END;

 

Now we can create an event action for this event to do the real work.

Reply from the external web service is stored as a blob in  MESSAGE_VALUE column in fndcn_message_body_tab

 select MESSAGE_VALUE from fndcn_message_body_tab

   where application_message_id = '&APPLICATION_MESSAGE_ID'

   and REPLY = 1;

 

 

 

after this point, it’s converting reply to xml (or json) and process via standard plsql logic.

 

Hope it helps!

View original
Did this topic help you find an answer to your question?

8 replies

GPIE
Hero (Customer)
Forum|alt.badge.img+11
  • Hero (Customer)
  • 113 replies
  • May 20, 2020

Hi Kresten,

I haven’t used this process so this is just a guess...

Create a Routing Rule for the READER_RESPONSE queue and configure an output such as To File.

I’ll try this and see if it works...


GPIE
Hero (Customer)
Forum|alt.badge.img+11
  • Hero (Customer)
  • 113 replies
  • May 20, 2020

And you can access the READER_RESPONSE messages in Application Messages.

 


krestensb
Sidekick (Customer)
Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • 40 replies
  • May 20, 2020

The response doesn’t come as an application message.

I don’t have the READER_RESPONSE queue, and it doesn’t show in any other queue.

I’m not sure how to handle this...


Forum|alt.badge.img+19

If you want the technical info to use in Lobby/Event/Quick Report etc.:

The response(s) to an application message is saved in table fndcn_message_body_tab with column REPLY set to 1.

There is a view MESSAGE_BODY which shows the records from that table which you shall use instead of the table directly. 


dsj
Superhero (Partner)
Forum|alt.badge.img+22
  • Superhero (Partner)
  • 832 replies
  • Answer
  • May 22, 2020

Elaborating the answer by @Tomas Ruderfelt , here’s what I have done in a similar scenario where I had to process the reply from an external web service in Apps9 without doing any code modification :wink:

In my scenario, I’m getting the currency rates from an external API and update IFS currencies.

1: Create an event on FNDCN_APPLICATION_MESSAGE_TAB based on STATE field

 

Event Action: remember to add proper conditions just to trigger the action only for your integration, and state = Finished

This calls another event in a background job. Reason for taking this approach is the message reply is not commit at this time so we can’t access it directly from the event action on FNDCN_APPLICATION_MESSAGE_TAB

 

Code:

declare

  event_enabled_ BOOLEAN := Event_SYS.Event_Enabled('Event','CURRENCY_UPD_EXECUTE');

  parameters_    VARCHAR2(32000);

  event_msg_     VARCHAR2(32000);

  id_            NUMBER;

begin

  IF event_enabled_ THEN

    Fnd_Session_API.Impersonate_Fnd_User(fnd_session_api.get_app_owner);

    event_msg_ := Message_SYS.Construct('CURRENCY_UPD_EXECUTE');

    Message_SYS.Add_Attribute(event_msg_,'APPLICATION_MESSAGE_ID','&NEW:APPLICATION_MESSAGE_ID');

    Client_SYS.Add_To_Attr('EVENT_LU_NAME_', 'Event', parameters_);

    Client_SYS.Add_To_Attr('EVENT_ID_','CURRENCY_UPD_EXECUTE',parameters_);

    Client_SYS.Add_To_Attr('EVENT_DATA_', event_msg_, parameters_);

  

    Transaction_SYS.Deferred_Call(id_,'EVENT_SYS.EVENT_EXECUTE','PARAMETER',parameters_,'Process cureency XML');

    Fnd_Session_API.Reset_Fnd_User;

  END IF;

end;

 

Script to create the CURRENCY_UPD_EXECUTE event:

 

BEGIN

   Event_SYS.Enable_Event('Event', 'CURRENCY_UPD_EXECUTE',

                          'Execute Currency XML',

   'APPLICATION_MESSAGE_ID/STRING^');

END;

 

Now we can create an event action for this event to do the real work.

Reply from the external web service is stored as a blob in  MESSAGE_VALUE column in fndcn_message_body_tab

 select MESSAGE_VALUE from fndcn_message_body_tab

   where application_message_id = '&APPLICATION_MESSAGE_ID'

   and REPLY = 1;

 

 

 

after this point, it’s converting reply to xml (or json) and process via standard plsql logic.

 

Hope it helps!


krestensb
Sidekick (Customer)
Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • 40 replies
  • May 22, 2020

Thanks, I have been looking for this solution for a very long time.


dsj
Superhero (Partner)
Forum|alt.badge.img+22
  • Superhero (Partner)
  • 832 replies
  • May 25, 2020
krestensb wrote:

Thanks, I have been looking for this solution for a very long time.

My pleasure to help!.

In Apps 10, there’s a new feature to call a PLSQL method directly to process the response so you don’t need this workaround :)

 

/Damith


krestensb
Sidekick (Customer)
Forum|alt.badge.img+8
  • Author
  • Sidekick (Customer)
  • 40 replies
  • May 25, 2020

We are waiting for this upgrade :)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings