Sunday, August 27, 2023

How to invoke Java Custom Function in BW5

TIBCO BW Provides various built-in palette activities which can be drag and drop on the design panel and then configured to create simple to complex process flows for implementing different types of integration logics. But, there can be cases where some custom code needs to be incorporated. 

TIBCO BW provides Java Palette activities which can be used to invoke any custom Java code to the process.

Here, I will explain how to invoke Java Custom Function..

Create a simple Java program, but complex Java code existed in real-time.

public class Student {


public static String getResult(int marks) {

if (marks >= 35)

return "You are Passed..";

else

return "Sorry, better luck next time";

}

public static void main(String[] args) {

System.out.println(getResult(5));

}

}

Then, generate ".class" file by using terminal. C\>javac <file-Name.java>


Take JavaCustomFunction from Java Palette and configure it as shown below...
Specify Suggested Prefix, Class Location and then click on Load.

Create a simple Business Process ..

On Start Activity:


On Mapper Activity - Input Editor


On Mapper Activity - Input Tab


Click on Xpath> Functions (search your custom function..)

On Mapper Activity - Output Tab (just check it)

Test Results
Input:


Output:











No comments:

Post a Comment

XML Palette Activities

The XML palette provides activities for parsing XML strings into schemas and rendering schemas into XML strings Parse XML: Parse XML  is use...