Skip to content

Invoke_Outbound_Message

The Invoke_Outbound_Message procedure synchronously invokes a messge via IFS Connect and waits for the reply. The supplied message body record or document is converted to XML and attached as a binary body to an application message. Alternatively it is possible to send an XML or a JSON document directly as CLOB data.

Invoke_Outbound_Message has been created specifically to invoke a remote service (for example a web service) via the IFS Connect framework and from within PL/SQL code.

PROCEDURE Invoke_Outbound_Message (    
   message_body_            IN OUT <one of: type_record_ or Plsqlap_Document_API.Document>,  
   sender_                  IN VARCHAR2 DEFAULT NULL,  
   receiver_                IN VARCHAR2 DEFAULT default_recevier_,  
   message_type_            IN VARCHAR2 DEFAULT default_media_code_,  
   message_function_        IN VARCHAR2 DEFAULT default_class_id_,  
   timeout_                 IN NUMBER DEFAULT NULL,  
   parameters_              IN CLOB DEFAULT NULL);

PROCEDURE Invoke_Outbound_Message (  
   xml_                     IN OUT CLOB,  
   sender_                  IN VARCHAR2 DEFAULT NULL,  
   receiver_                IN VARCHAR2 DEFAULT default_recevier_,  
   message_type_            IN VARCHAR2 DEFAULT default_media_code_,  
   message_function_        IN VARCHAR2 DEFAULT default_class_id_,  
   timeout_                 IN NUMBER DEFAULT NULL,  
   parameters_              IN CLOB DEFAULT NULL);

PROCEDURE Invoke_Outbound_Message (  
   json_                    IN OUT CLOB,  
   sender_                  IN VARCHAR2 DEFAULT NULL,  
   receiver_                IN VARCHAR2 DEFAULT default_recevier_,  
   message_type_            IN VARCHAR2 DEFAULT default_media_code_,  
   message_function_        IN VARCHAR2 DEFAULT default_class_id_,  
   timeout_                 IN NUMBER DEFAULT NULL,  
   parameters_              IN CLOB DEFAULT NULL,
   is_json_                 IN BOOLEAN);

Parameters

message_body_
    A Record or Document that corresponds to the entity definition. This record/document will automatically be converted to XML and attached as a binary body to the message before it is sent.

xml_
    An XML document that corresponds to the entity definition. The XML is attached as a binary body to the message before it is sent.

json_
    A JSON structure that corresponds to its definition. The JSON is attached as a binary body to the message before it is sent.

sender_
    Optional identity of sending organization.

receiver_
    Optional identity of receiving organization.

message_type_
    Optional. The value will be entered in FNDCN_APPLICATION_MESSAGE_TAB.MESSAGE_TYPE.

message_function_
    CURRENTLY NOT USED.

timeout_
    Optional timeout in seconds.

parameters_
    Optional  If the message is REST outbound message some parameters has to be passed with the message to be used at the application side. This is sent via plsql_rest_sender_api.

*is_json_

  • This should be set to TRUE when invoking methods used to send the data in JSON format

Record handling

Invoke_Outbound_Message will not delete the input/output record. To prevent superfluous consumption of temporary tablespace, a PLSQLAP_Record_API.Clear_Record procedure call must be issued when finished with processing the record. If working with Documents (recommended) the cleaning is not required.

Example

DECLARE  
   doc_   PLSQLAP_Document_API.Document;  
   id_    PLSQLAP_Document_API.Element_Id;  
   date_  DATE := to_date('2014-10-15 14:44','YYYY-MM-DD HH24:MI');  
BEGIN  
   -- Prepare input data  
   doc_ := PLSQLAP_Document_API.New_Document('TEST_ORDER');  

   PLSQLAP_Document_API.Add_Attribute(doc_, 'COMMENTS', 'Outbound Sync - SendTestOrder');  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'COMPANY', '01');  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'DELIVERY_DATE', date_, type_ => PLSQLAP_Document_API.TYPE_TIMESTAMP);  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'CUSTOMER_ID', '01234');  

   id_ := PLSQLAP_Document_API.Add_Array(doc_, 'ORDER_LINES');  
   id_ := PLSQLAP_Document_API.Add_Document(doc_, 'TEST_ORDER_ITEM', id_);  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'AMOUNT', 12324344, id_, PLSQLAP_Document_API.TYPE_FLOAT);  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'PRICE', 812324344, id_, PLSQLAP_Document_API.TYPE_FLOAT);  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'DESCRIPTION', 'Hello All', id_);  
   PLSQLAP_Document_API.Add_Attribute(doc_, 'PRODUCT_NO', 'A144522', id_);  

   -- Invoke a remote service through IFS Connect. A correct application message with the given document as XML   
   -- body will be created. The application message will then be routed according to configured message routing,  
   -- any transport connectors (for example HTTP sender) invoked synchronously, and the final result   
   -- returned here. This way you can for example invoke a remote web service from within PL/SQL!  
   PLSQLAP_Server_API.Invoke_Outbound_Message(doc_, 'CONNECT','CONNTEST_OUTSYNCDOC');  
END;  
/