Enter your keyword

post

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 !!

Some Toughts (6)

  1. Anonymous
    added on 30 May, 2017
    Reply

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

  2. Anonymous
    added on 15 Mar, 2018
    Reply

    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?

  3. added on 14 Dec, 2018
    Reply

    You won't believe me, but I was planning to write a blog very similar to the one you have posted here. Great work!

    Selenium Training In Chennai

    Java Training In Chennai

  4. added on 18 Jun, 2019
    Reply

    Hi Ankur,
    I have a java program to send email with multiple attachments.The same integrated in osb through java callout but it is sending only one attachment.I am assigning the array list like data($body//*:fileContents) into one variable.Could you kindly help me here how to assign arraylist in osb

  5. added on 18 Jul, 2019
    Reply

    Thanks for sharingcustom erp solutions

  6. added on 19 Jul, 2019
    Reply

    Hi Ankur,

    Where we can see the logs of JAVA code which is used in JAVA callout activity

Leave a Reply

Your email address will not be published.