cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a JAVA program during mapping

Former Member
0 Kudos

Is there an example of calling Java Program to decrypt a field or encrypt a field using the Graphical Mapping Tool in XI 3.0 ( SP14)

The goal is to use external encryption/decryption tools, which are existing in J2EE external to XI and WAS.

Is this possible. If so Can any one let me know the code to this.

Appreciate your response.

Regards

Prasad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Prasad,

Have a look at this thread..Think it will help you out!

cheers ,

Prashanth

Former Member
0 Kudos

Thank you for your response.

I am unable to open or see the following thread.

Can you open it and send me the link.

Also, My question refers to a de-crypting or en-crypting

a specific field ( like CC number) using GUI-Mapping.

Appreciate if you can let me know , if any one has specific answers to the question.

Regards

Prasad

former_member184154
Active Contributor
0 Kudos

Hi Prasad,

that should be straightforward.

Assuming you have kinda .jar file containing your classes to do enc/dec, create an imported archive and upload you .jar

Then in the mapping you have to write a User defined function, declare the classes you need to use in the "import" with full package name (e.g. com.creditcard.utils.Decryption) and then use them along the Java code. Assuming your class is called "Decryption", and your parameter is called "CreditCard", could be just something like:

return Decryption.Decrypt(CreditCard);

Ok?

Regards,

Alex

Former Member
0 Kudos

Alex

I have followed the instructions: a) Imported the JAR

b) Created User defined function with an import statement.

How does the imported archive can be linked with XI Java Mapping routines. Looks like I am missing a step.( Class Path ?)

Thanks

Prasad

I am getting following syntax error:

/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map4d26db40835211dac87400096bee8e8a/source/com/sap/xi/tf/_encryptedData_MM_.java:3: package com.xxxxx does not exist

import com.sap.aii.mappingtool.tf3.;import com.sap.aii.mappingtool.tf3.rt.;import java.util.;import java.io.; import java.lang.reflect.*;import com.xxxxxx.encryption; ^ /usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map4d26db40835211dac87400096bee8e8a/source/com/sap/xi/tf/_encryptedData_MM_.java:40: cannot resolve symbol symbol : variable AESCryptor3 location: class com.sap.xi.tf._encryptedData_MM_ return AESCryptor3.encrypt(a, "password");

former_member184154
Active Contributor
0 Kudos

You have to declare your package/class in the "Imports" edit box: it's in the popup of your UDF when you edit it, just below "Description".

Cheers,

Alex

Former Member
0 Kudos

Alex

Is there a contact number so that I can call you.

Regards

Prasad

former_member184154
Active Contributor
0 Kudos

It would not be a problem for me (my mobile is my SDN BC) but I'm currently workin' in a kind of bunker with no mobiles signal...

Look, open the jar file with winzip and look into it. Find the class(es) you need to use, write here in the forum their full path filename and I will give the correct string to put as imports, ok?

Alex

Former Member
0 Kudos

Alex

Here is information that I am using. appreciate your help.

Thanks in advance

Prasad

Class Name: AESCryptor3.class

Path : com/antioch/encryption

The above is imported archive in Int repository.

I have put in UDF Imports --> <b>com.antioch.encryption.AESCryptor3</b>;

The code is as follows:

public String Encrypt_Function(String a, Container container){

//write your code here

return AESCryptor3.encrypy(a,"password")

}

I get the following Error

Source code has syntax error: /usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapeec0db50835b11daaee800096bee8e8a/source/com/sap/xi/tf/_encryptedData_MM_.java:40: <b>unreported exception java.lang.Exception; must be caught or declared to be thrown return AESCryptor3.encrypt(a,"password");</b> ^ 1 error

former_member184154
Active Contributor
0 Kudos

Not a big deal.

The import is correct.

Just protect your statement, like this:

try {
    return AESCryptor3.encrypy(a,"password"); }
catch (Exception e) {
    return "ErrorEncryption";
}

Former Member
0 Kudos

Alex

Your help is most appreciated. With your help I am able to test the Encryption and Dycryption algorithm on a Field.

Thank you .

You get the full points.

Regards

Prasad

Answers (0)