Tuesday, 17 January 2017

Java callout in OSB

Sometimes Oracle Service Bus is not sufficient to meet our requirements. To do so OSB provides Java Callout activity that is used to call java code from OSB.

In this blog, I will explain a very basic example to use Java Callout Activity.

There are some restrictions to use Java Callout activity:

  • Java code must be packaged as jar
  • The java method that will be called from OSB, must be static
Let's proceed with an example

1) Create a simple java class:

JAVA callout in OSB

2) Create jar that will contain the .class file.

3) Copy the jar file in the OSB project

4) Drag the Java Callout activity in the pipeline and configure the properties

JAVA callout in OSB


Method: Browser the jar and select the method that you want to call and click OK
Arguments: Set the value of arguments
Return: Assign the variable in which you want to get the output of the method

5) Drag the log activity and print the greeting variable

6) Run the pipeline and see the output


That's it !!

2 comments:

  1. Thanks Ankur, This is a great blog. Always get new things to learn. Regards, Sanddy

    ReplyDelete
  2. Hi Ankur,

    Why we need to pass argument in design time? Lets say, I need to pass "DHONI" at run time from the input variable, how will it work? Can we pass $Name from the input xml to the argument so that it is dynamic?

    ReplyDelete