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:
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
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 !!
Thanks Ankur, This is a great blog. Always get new things to learn. Regards, Sanddy
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?
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
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
Thanks for sharingcustom erp solutions
Hi Ankur,
Where we can see the logs of JAVA code which is used in JAVA callout activity