One major challenge in integrations is that data formats vary among different systems. In order to successfully connect multiple systems, it is essential to have a method of translating the data types and formats between the systems.

Transformer is the component in IFS integration framework which plays this essential role of translating source document to target document format. They can be applied to incoming documents to convert any file format into an IFS compatible format and to convert outgoing document from IFS into any format required by the receiver.

About IFS Transformers

IFS supports two types of transformers

  • Stylesheet – Transformer which defined in XSLT format
  • Java – Java class implementation to perform the transformation.

Stylesheet (XSLT) transformers are easy to create, use global standards and handy with transforming XML type documents but when we need to transform data between non-xml formats, it is hardly useful.

Java transformers are purely based on java standards and provide much more freedom to transform the documents and to use third party libraries if required.

A Java transformer can be compiled to a single class file or build to a jar library. second option is useful when you use third party libraries in your transformer so you can build the jar with all dependencies.

Transformer definitions are saved in IFS database and deployed into integration runtime. Therefore customer can manage it as a configuration as far as code maintenance is handled separately.

In this post, I wish to explore following topics

Getting Started with IFS Java Transformer Development

Java transformer can be develop by creating a class implementing the IFS Java Transformer interface.

Note that transformer interface has changed in IFS Applications 10 and therefore use the correct interface for your IFS version from below.

  • App10: ifs.fnd.connect.xml.Transformer
  • App9 or below: ifs.fnd.tc.framework.xml.Transformer

Required libraries

  • IFS_HOME\repository\server\javaruntime\ifs-fnd-connect.jar
  • IFS_HOME\repository\server\javaruntime\ifs-fnd-base.jar

IFS Java transformer interface requires overriding below functions

  • init() – called only once when the class is loaded from the database into memory.
  • transform() – called to transform the actual data.

Class Template for Java Transformer:

Note that you should not place the class inside a package. It should be inside the default package.
import ifs.fnd.base.IfsException;
//app10
import ifs.fnd.connect.xml.Transformer;
//app9
import ifs.fnd.tc.framework.xml.Transformer;

public class javaTransformer implements Transformer {

   @Override
   public void init() throws IfsException {
   }

   @Override
   public String transform(String sIn) throws IfsException {
      return sIn;
   }
}

Example Java Transformer

In this example, we will create a simple java transformer which converts incoming CSV document of accounts to XML format which can be input to IFS with ReceiveAccount BizApi.

Complete code for this transformer can be found in my GitHub.

Given below is the source CSV and the resultant XML from transformer looks

Source CSV and resultant XML using IFS Java Transformer
Source CSV and resultant XML using IFS Java Transformer

Folder structure of the transformer project:

Folder structure of the transformer project

I’ve not used any IDE to create the transformer and trying to minimise usage of other java libraries in this example. You can use your own code structure or IDE and use java libraries compatible with IFS java runtime. Take extra precautions to properly handle exceptions since unhanded errors could lead to severe situations like crashing the middleware or stop integration processing.

Content in the src/csvToXmlApp10.java is self-explanatory and what it basically does is get the file content as a java String and create the XML structure.

Compiling the code:

Open command prompt and navigate to src folder

Make sure you use the recommended JDK for your current IFS version. Using newer JDK version will result in version incompatibility errors in runtime and transformer unusable.
Tip: JDK 1.8 is the used JDK version in IFS Applications 10 and 9.
..\src>javac -d ..\bin -cp ..\lib\ifs-fnd-base.jar;..\lib\ifs-fnd-connect.jar; csvToXmlApp10.java

Testing the Transformer locally

src/testTransformer.java uses the testFiles/accounts.csv CSV file and prints the transformer output. Compile the test file with following.

..\src>javac -d ..\bin -cp ..\lib\ifs-fnd-base.jar;..\lib\ifs-fnd-connect.jar; testTransformer.java

To run the Test class, navigate to bin folder and execute following.

..\bin>java -cp ..\lib\ifs-fnd-base.jar;..\lib\ifs-fnd-connect.jar; testTransformer

Deploying the Java Transformer in IFS

Login to IFS EE and navigate to Setup IFS Connect window. RMB on Trnasformer node, New.

Provide a Transformer name and select JavaTransformer as Instance Type.

Press Load and select the transformer class

Using the Transformer

A transformer can be used to convert incoming documents as well as outgoing documents. In IFS, inbound and outbound document destinations are defined using Routing Address. Multiple transformers can be added to a Routing Address and each transformer is applied in a sequence to the message content.

Routing Address in IFS Applications 10.
Routing Address in IFS Applications 10.

Response Transformers is used to transform the response of synchronous flow and works similar to the message transformer.

IFS provides set of transformers which is helpful in common integration scenarios such as eInvocing, SEPA, Taxation …etc.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s