Ticker

6/recent/ticker-posts

Ad Code

Responsive Advertisement

Optimizing Integration: Retrieving and Displaying Multiple Values using Java Methods in OSB 12C


In OSB, while using the JAVA Callout function, we often face a limitation where if a Java program returns a single value, we can assign it to a result set in OSB and display it in the payload. However, if the Java program returns multiple values, it becomes challenging to assign them to a result set in OSB. In such cases, we need to create an XML format for the payload within the Java program itself to handle the multiple return values.

To achieve the above objective, we first need to create a Java file and then generate a JAR file based on it.


Generate the JAR based on below JAVA program. Generate JAR File



package javamultixmlprj; import org.apache.xmlbeans.XmlObject; public class CustJavaMultiXML { public CustJavaMultiXML() { super(); } static XmlObject newObject; public static XmlObject CustomerAddress(int CustId) { String Name=""; String City=""; String Designation=""; if (CustId==1000) { Name="Pranay Tiwari"; City="Columbus"; Designation="Application Developer" ; } else { Name="Ralph Dmitri"; City="Chicago"; Designation="Enterprise Architect" ; } String xmlString = String.format("<Customer xmlns=\"http://www.xmlobject.test/xml\">\n" + "<Name>" + Name + "</Name>\n" + "<City>" + City + "</City>\n" + "<Designation>" + Designation + "</Designation>\n" + "</Customer>\n"); try { XmlObject object = XmlObject.Factory.parse(xmlString); return object; } catch (Exception e) { e.printStackTrace(); return newObject; } } }


Create Service Bus Application -> JavaMultiReturnAPP







Create Project --> JavaMultiReturnPRJ








Enregistrer un commentaire

0 Commentaires