Skip to Content
author's profile photo
Former Member

User-defined function in multiple Message Mappings

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    author's profile photo
    Former Member
    Sep 29, 2005 at 11:17 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo
    Former Member
    Sep 29, 2005 at 08:12 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Sep 29, 2005 at 09:01 AM

    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

    Add comment
    10|10000 characters needed characters exceeded