The following steps discuss how a new Java-based Web Service is created, and include options (steps 2-8) for generating parts of the code automatically:
Go to Project Tree, right-click Web Services > New Web Service to display the Function Editor window.
Click either the Objects or Database tab (left pane) and then either > DB Interface, Newest Reference File or Newest LU File.
Select the preferred DB Connection. To access Fabric, select Newest LU Name. Note that for the newest file of an LU to be a part of the DB Connections list, at least one LUI must be executed using the Data Viewer.
Click the DB File icon to display the Logical Unit Tables list.
Click the table that retrieves the data, check the Columns list and right-click the column that is the Input parameter for data retrieval.
Click Add Selected to Input Parameters.
Note that the Column Name, Data Type, Mandatory and Comments are displayed in the Input Parameters list in the lower right pane.
Select the Column/s to be retrieved or press the CTRL key to select multiple columns. Right-click and select Generate Code to automatically create the Select Statement and Basic Code Structure.
The generated code is displayed in the Java Editor window and includes the basic structure of the call to the interface or LUDB and the Fetch method. Note that you can also write your own code.
Once the code is generated, edit the function based on the logic to be applied. For example:
Db.Rows rows = ludb("Customer", <instanceID>).fetch(sql, <val1>, <val2>, ...);
Replace the <instanceID> placeholder with the input parameter CUSTOMER_ID.
Db.Rows rows = ludb("Customer", CUSTOMER_ID).fetch(sql);
In Fabric top menu bar - choose New Web Service > New Java Web Service.
In the pop-up input box, at the top of the screen, either select a category from the list or choose to create a new one.
In the next pop-up input box - fill in the name for the web service.
The Logic Java file will then be opened and populated with the default template skeleton of a web service function.
@desc("")
@webService(path = "", verb = {MethodType.GET, MethodType.POST}, version = "1", isRaw = false, isCustomPayload = false, produce = {Produce.XML, Produce.JSON}, elevatedPermission = false)
@resultMetaData(mediaType = Produce.JSON, example = "")
public static void webServiceName(@param(description="") String param1) throws Exception {
}
Notes that you can add web services functions by pressing CTRL -> SPACE and selecting the requested snippet (tip: start typing fabric to reveal the required one - "fabric-function-ws").
The following steps discuss how a new Java-based Web Service is created, and include options (steps 2-8) for generating parts of the code automatically:
Go to Project Tree, right-click Web Services > New Web Service to display the Function Editor window.
Click either the Objects or Database tab (left pane) and then either > DB Interface, Newest Reference File or Newest LU File.
Select the preferred DB Connection. To access Fabric, select Newest LU Name. Note that for the newest file of an LU to be a part of the DB Connections list, at least one LUI must be executed using the Data Viewer.
Click the DB File icon to display the Logical Unit Tables list.
Click the table that retrieves the data, check the Columns list and right-click the column that is the Input parameter for data retrieval.
Click Add Selected to Input Parameters.
Note that the Column Name, Data Type, Mandatory and Comments are displayed in the Input Parameters list in the lower right pane.
Select the Column/s to be retrieved or press the CTRL key to select multiple columns. Right-click and select Generate Code to automatically create the Select Statement and Basic Code Structure.
The generated code is displayed in the Java Editor window and includes the basic structure of the call to the interface or LUDB and the Fetch method. Note that you can also write your own code.
Once the code is generated, edit the function based on the logic to be applied. For example:
Db.Rows rows = ludb("Customer", <instanceID>).fetch(sql, <val1>, <val2>, ...);
Replace the <instanceID> placeholder with the input parameter CUSTOMER_ID.
Db.Rows rows = ludb("Customer", CUSTOMER_ID).fetch(sql);
In Fabric top menu bar - choose New Web Service > New Java Web Service.
In the pop-up input box, at the top of the screen, either select a category from the list or choose to create a new one.
In the next pop-up input box - fill in the name for the web service.
The Logic Java file will then be opened and populated with the default template skeleton of a web service function.
@desc("")
@webService(path = "", verb = {MethodType.GET, MethodType.POST}, version = "1", isRaw = false, isCustomPayload = false, produce = {Produce.XML, Produce.JSON}, elevatedPermission = false)
@resultMetaData(mediaType = Produce.JSON, example = "")
public static void webServiceName(@param(description="") String param1) throws Exception {
}
Notes that you can add web services functions by pressing CTRL -> SPACE and selecting the requested snippet (tip: start typing fabric to reveal the required one - "fabric-function-ws").