Thursday, August 31, 2023

SOAP WebServices - BW 5.x

What is SOAP.?

SOAP - full form is Simple Object Access Protocol. It is an XML-based messaging protocol for exchanging information among computers. SOAP is an application of the XML specification.

Here, I will explain step by step approach - how to develop a SOAP web service in TIBCO BW.

Provider:

First, we will see how to use Tibco-BW is a web service provider..

Create a simple business process, here I have created process to fetch DB records based on emp-id


Start Activity

JDBC Query Activity




End Activity


Schema

Sample DB records


Now, create a WSDL from the Business Process. Follow the instructions as shown below..



Save the WSDL and share it with your consumers. Here, we're testing by using SOAP UI.

Once you have generated successfully, you can see three artifacts in your project work-space

Testing with the help of SOAP UI
Click on SOAP icon and specify WSDL as input..

Consumer: 
If Tibco BW as a consumer, take WSDL as input and hit remote endpoint and get the response.



It's very simple, take SOAPRequestReply activity and follow guidelines as shown in above screenshot


Hope this helps.. 
Thanks for reading :-)








Tuesday, August 29, 2023

How to use "JDBC Call Procedure" in BW5

In some business cases, you may have to call DB - Stored Procedures inside of your Tibco Business process.

Here, I am going to explain step by step approach..

In real-time, DB team will create stored procedures and share those details with Tibco team.

For learning purpose, create a simple stored procedure in MySQL DB.

Here, the procedure "getAllEmpDetails " being called in Tibco Business process..

CREATE DEFINER=`root`@`localhost` PROCEDURE `getAllEmpDetails`()

BEGIN

    SELECT * FROM EMP;

 END

    SELECT * FROM EMP;

Next, create DB-Connection in Tibco BW


Sample Business Process:

Configure "JDBC Call Procedure" activity with proper details..as shown above

WriteToFile activity

Finally, file has been created.



Thanks for reading :-)

Monday, August 28, 2023

Types of Variables | BW-5

Variables 


When implementing business processes, we would need variables to store data elements. There are three types of variables available in TIBCO BW..

  • Global Variables
  • Process Variables
  • Shared Variables
Global Variables
Global variables helps you to specify constants which can be used throughout the project. The constants can be specified and changed while designing and testing your project. You can also specify different values while deploying business process from Dev -> QA -> PROD.

Global variable are used mainly for setting environment variables such as JDBC/JMS/HTTP/FTP/IP Address/Port/Login(UserName, Password) connection details. 

Process Variables
Process variables helps you to access various data-elements in your project. 
There are predefined process variables containing the process ID, project name, etc. And, you can also create user-defined process variables for carrying process-specific data.

Process variables are data structures to the activities in the business process. Process variables are appeared in the Process Data panel of every activity’s Input tab.

Shared variables
There are two types of shared variables..
  1. Shared variables
  2. Job shared variables
Shared Variables:
Shared variables are used to share data across process instances. Multiple process instances can read and write data to this shared variable.

Job Shared Variables:
Job Shared variables helps you to share data in that job only. If any of the other process is using this variable then they might get different output value. This is useful for passing data in sub processes. 

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:











How to use Custom Java Code in BW5

In some specific cases, you may have to use Java code in Tibco BW5.

Use cases like some complex business logic has been implemented in Java or legacy code already existed, where you can use Java palette for your business case.

Feel free to go through Tibco documentation for Java activities based on your use case.

Here, the business process will take first name and last name as inputs and concat these names with the help of Java code and returns full name.



On Start activity:
Take two strings, fName,lName 

On Java Code Activity
Java Code activity is available in Java Palette..define input and output parameters, type and cardinality 

Under Code Tab

If no compilation errors and go to next step, else fix the errors and then proceed.

Under Input Tab/Output Tab
Map input variables as shown below and Output tab shows parameters as your Java Code.

Output: After executed Business Process:
Input:
Result Output:









Thursday, August 24, 2023

Database (MySQL) to File System

 How to Read Data From Database and send XML data file to a file system

Here, I am going to explain how to retrieve the data from Database based on EMP ID and then convert it into XML and send it to FileSystem.


Create DB connection and TEST the connection..


                        On Start Activity






Create XML Schema to parse the DB data


Group


Render XML activity



Send the XML data to file system by using WriteFile activity


DB Table:


Result:


Source Code:



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