Invoke_Outbound_Request_BizAPI

The Invoke_Outbound_Request_BizAPI procedure synchronously invokes a BizAPI and waits for the reply. The supplied message body record is converted to XML and attached as a binary body to an application message.

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

PROCEDURE Invoke_Outbound_Request_BizAPI(
   bizapi_name_             IN     VARCHAR2, 
   message_body_            IN OUT type_record_,
   sender_                  IN     VARCHAR2                 DEFAULT NULL,
   receiver_                IN     VARCHAR2                 DEFAULT default_recevier_,
   connection_string_       IN     type_connection_string_  DEFAULT NULL );

Parameters

bizapi_name_
    Name of the BizAPI as specified in the repository. For example 'GET_STOCK_QUOTE'. The BizAPI name is used to set the message type and function attributes of the application message.

message_body_
    A record that corresponds to the BizAPI view definition. This record will automatically be converted to XML and attached as a binary body to the message before it is sent.

sender_
    Optional identity of sending organization.

receiver_
    Optional identity of receiving organization.

connection_string_
    Optional connection string to an application server. If no connection string is supplied the call will be to the application server set in the configuration (Set_Plsqlap_Environment).

Record handling

Invoke_Outbound_Request_BizAPI 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.

Example

DECLARE
   sqr_ PLSQLAP_Record_API.type_record_;
BEGIN
   -- create a record corresponding to the view which is the BizAPIs parameter
   sqr_ := PLSQLAP_Record_API.New_Record('STOCK_QUOTE.STOCK_QUOTE_REQUEST');
   PLSQLAP_Record_API.Set_Value(sqr_, 'SYMBOL', 'MSFT');

   -- Invoke a remote service through IFS Connect. A correct application message with the given record as XML 
   -- body will be created. The application message will then be routed according to configured message routing,
   -- any transport connectors (for example SOAP connector) invoked synchronously, and the final result 
   -- returned here. This way you can for example invoke a remote web service from whithin PLSQL!
   PLSQLAP_Server_API.Invoke_Outbound_Request_BizAPI('GET_STOCK_QUOTE', sqr_);

   -- debug the record returned from the BizAPI to see what was returned
   PLSQLAP_Record_API.Debug(sqr_);
  
   -- remove record from temporary tablespace
   PLSQLAP_Record_API.Clear_Record(sqr_);
END;
/