Leveraging Java Method Callout in OSB 12c for String Concatenation: A Step-by-Step Guide

This article will cover the implementation of string concatenation using the Java Callout method. To achieve this integration, we must first develop a dedicated Java class for string concatenation. Afterward, we will generate a JAR file for the class and deploy it to the classpath of the OSB runtime. Then, we can reference the JAR file in the Java Callout component of OSB to leverage its functionality for seamless integration.



To create the Java class, the following code can be used:


package javamethod;

public class JavaConcatMethod {
    public JavaConcatMethod() {
        super();
    }
    
    
    public static String ConcatString(String Input1,String Input2)
    {
   
   return "Welcome JAVA CAllout Assignment "+Input1 +"and"+ Input2;
    }
}


Once the Java class is created, the next step is to create and deploy the JAR file. Refer to the link below for instructions on how to do this: Generation of JAR file


I have created JAR file by following the above instructions JavaConcateDeploy.jar



After successfully generating the JAR file, let's create an OSB integration.

First, create a Service Bus application and provide a name for it, such as "JavaStringConcatApp".


First Create Service Bus Application --> Provide Application Name --> JavaStringConcatApp








Create Project under the Application 

Create Project --> JavaStringConcatPRJ








Once Project has been created , create folders under the project. Copy the new created JAR file under the JAR folder





After creating the project, the next step is to create a schema definition file in XSD format. Once the XSD is created, we can generate the WSDL file.







Using this XSD , create WSDL by following below steps




Select input and output request response 









Click finish to generate the WSDL file. 




Create Proxy service 




Provide the WSDL file and then click on Finish. 









Click on Pipleline Project and drop the Pipeline Pair 





Open the Oracle Service Bus Console and locate the Java Callout component.


Click on the Java tab and select the option to reference an external JAR file.
Save the configuration and test the implementation



Click on the Java tab and select the option to reference an external JAR file.






Browse to the location of the JAR file and select it.






Map the input parameters from WSDL 




Result section provide the variable name something like OutputVar






Click on Response PipleLine , tag the variable  $OutputVar. 






Run the integration 



String has been concatenated 




Comments

Popular posts from this blog

Sample HZ API's script to Create Contacts and Contact Points in Oracle

REST integration built-in OIC to read Large files with size more than 10MB