cancel
Showing results for 
Search instead for 
Did you mean: 

User-defined function in multiple Message Mappings

Former Member
0 Kudos

Hi,

I have created a user defined function in a message

mapping, and the same functionality is required in

multiple message mapping within the namespace or outside

the namespace. How can I use it ?

If I import it as a JAR Archive than too, I need to

import this class in the every user deined function

where I want to use this functionality.

That way I can copy that code also instead of importing

the archive.

Is there any other way through which I can use one of

my user defined function in multiple maps ???

Thanks,

Vijay

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

User-defined functions are specific to a message mapping. If you need the same function across multiple message mappings, you have to duplicate them in each mapping!

However, as Dominik suggests, you can keep the user-defined function light and transfer the entire logic to a java class (not an ejb) and import this class as an archive. As a result, the duplicated user-defined function will have only the invocations to external java class.

Regards,

Suresh.

Former Member
0 Kudos

> However, as Dominik suggests, you can keep the

> user-defined function light and transfer the entire

> logic to a java class (not an ejb) and import this

> class as an archive. As a result, the duplicated

> user-defined function will have only the invocations

> to external java class.

yes of course, java class not ejb - my fault - thanks for that correction

Dominik

Former Member
0 Kudos

Hi Suresh.

Mapping class loader allows mapping program to access all classes of the boot class loader and only jar files in the same namespace where this mapping is located.

Therefore you need to implement your function in some static (or not static method) of some java file and pack this class to a jar file.

Then you have 2 options:

- put your jar to the boot class path of the J2EE server

- put this jar to every namespace where you going to use this function.

In the Message Mapping you'll need to create a wrapper for your function and that's a manual process for each mapping.

But you can use a workaround to prevent manual creation of similar functions in all mappings.

Just create a mapping template that contain all needed functions and then apply this template on each mapping you are working on. Even if your structure is different all functions from your mapping template will be added to the current mapping.

Best regards,

Dmitry Yankovsky

Answers (2)

Answers (2)

Former Member
0 Kudos

in BIT460 they told us to put code in an EJB project, deploy it, put it in a zip/jar file and import it in every SWCV it is needed (I hope I remember it correctly)

than call it (one line of code) in a simple user defined function

Regards

Dominik

Former Member
0 Kudos

I dont think it is possible to use same user defined function in multiple message mapping programs.

All I do is recreate the userdefined function with cut paste for using the same functionality.

Regards,

Satish