How to make use of a variable passed into the procedure and include the 'resource' variable in the procedure call?

How to make use of a variable passed into the procedure and include the 'resource' variable in the procedure call?

book

Article ID: KB0071136

calendar_today

Updated On:

Products Versions
TIBCO Data Virtualization All Supported versions

Description

This article elucidates how to retrieve all dependency data source resources linked to particular resources within TDV by using the web service operation 'getUsedDataSources.'. To execute this process via a web API call, write a procedure to run the web API call(s), publishing these as a procedure gives you the flexibility to use an external client application (e.g. TOAD, DBVisualiser) to connect to the TDV server via the TDV JDBC, ODBC, or Ado.Net driver and subsequently run the procedures.

Issue/Introduction

This article explains how to utilize the built-in web service operation 'getUsedDataSources' to fetch all dependency data source resources associated with specific resources within TIBCO Data Virtualization (TDV)

Environment

All supported Environments

Resolution

Below is an example Procedure that invokes the Web API call "/services/webservices/system/admin/resource/operations/getDependentResources", that makes use of a variable passed into the procedure and includes the 'resource' variable in the procedure call.
===========
PROCEDURE proc1(OUT response XML, IN resource VARCHAR)
BEGIN
  DECLARE fault XML;

  -- Declare xml_payload as an XML data type
  DECLARE xml_payload XML;

  -- Create the XML payload piece by piece
  SET xml_payload = '<resource:getUsedDataSources xmlns:resource="http://www.compositesw.com/services/system/admin/resource" xmlns:common="http://www.compositesw.com/services/system/util/common">' ||
    '<resource:entries>' ||
    '<resource:entry>' ||
    '<resource:path>/shared/examples/ds_orders/tutorial/' || resource || '</resource:path>' ||
    '<resource:type>TABLE</resource:type>' ||
    '</resource:entry>' ||
    '</resource:entries>' ||
    '<resource:detail>SIMPLE</resource:detail>' ||
    '</resource:getUsedDataSources>';

  -- Make the CALL statement using the constructed XML payload
  CALL /services/webservices/system/admin/resource/operations/getUsedDataSources (xml_payload, response, fault);
END
=======
When invoking the procedure, it is essential to furnish a value for the resource parameter. This value must be a string that signifies the resource you intend to include in the XML payload. The input value for the resource parameter will determine the resource name or value to be utilized in your XML payload when invoking the procedure.

User-added image