The Basic Structure of a Web Service Function

Fabric Studio enables you to automatically generate Java code that holds the basic components of a Web Service function.

Web Service Function: Basic Structural Components

Component

Description

String Declaration

String declaration of the SQL statement’s structure which includes the Column Name, Table Name, Join with Other Tables, and other SQL syntax elements.

For example, to generate an SQL statement to retrieve the CUSTOMER ID, SSN and FIRST_NAME from the CUSTOMER table:

  • String sql = "SELECT CUSTOMER_ID, SSN, FIRST_NAME FROM CUSTOMER";

Fetch Statement

Fabric gets a specific instance and fetches data from Fabric using the declared SQL statement.

Examples:

  • Get the data for a Customer LUI from the Fabric using the ludb() method. The ID parameter, sent to ludb() function is received as a WS input parameter:
    • Db.Rows rows = ludb("Customer", ID).fetch(sql); 
    • The SQL statement should be structured with binding parameter/s that are represented by a question mark. The parameter/s should be added to the Fetch method in the same order they are defined in the SQL statement.

  • Fetch the CUSTOMER data from the CRM_DB based on the CUSTOMER_ID as an Input parameter:
    • String sql = "SELECT CUSTOMER_ID, CUSTOMER_TYPE, CREATION_DATE FROM CUSTOMER WHERE CUSTOMER_ID = ? “; Db.Rows rows = db("CRM_DB").fetch(sql, custId);
    • Note that during runtime, the question mark is replaced by the Web Service’s input parameter value as the custID.

Return Statement

Terminates the execution of the Web Service function. Close the statement or connections if needed and return rs;

Previous

The Basic Structure of a Web Service Function

Fabric Studio enables you to automatically generate Java code that holds the basic components of a Web Service function.

Web Service Function: Basic Structural Components

Component

Description

String Declaration

String declaration of the SQL statement’s structure which includes the Column Name, Table Name, Join with Other Tables, and other SQL syntax elements.

For example, to generate an SQL statement to retrieve the CUSTOMER ID, SSN and FIRST_NAME from the CUSTOMER table:

  • String sql = "SELECT CUSTOMER_ID, SSN, FIRST_NAME FROM CUSTOMER";

Fetch Statement

Fabric gets a specific instance and fetches data from Fabric using the declared SQL statement.

Examples:

  • Get the data for a Customer LUI from the Fabric using the ludb() method. The ID parameter, sent to ludb() function is received as a WS input parameter:
    • Db.Rows rows = ludb("Customer", ID).fetch(sql); 
    • The SQL statement should be structured with binding parameter/s that are represented by a question mark. The parameter/s should be added to the Fetch method in the same order they are defined in the SQL statement.

  • Fetch the CUSTOMER data from the CRM_DB based on the CUSTOMER_ID as an Input parameter:
    • String sql = "SELECT CUSTOMER_ID, CUSTOMER_TYPE, CREATION_DATE FROM CUSTOMER WHERE CUSTOMER_ID = ? “; Db.Rows rows = db("CRM_DB").fetch(sql, custId);
    • Note that during runtime, the question mark is replaced by the Web Service’s input parameter value as the custID.

Return Statement

Terminates the execution of the Web Service function. Close the statement or connections if needed and return rs;

Previous