In this recipe, we show how to change the response and enrich the message by a value for the rating attribute. For that, we have to create a Java class that we will call from the message flow of the proxy service through a Java Callout action:
We have created a simple Java class as shown in the following screenshot:
As we can see, this Java class has one method, which enriches the value of the rating attribute of a customer object based on the value of the first name attribute. The method accepts a parameter of type Object
and cast this to a Customer
type.
To make it available to OSB, we have to package the Java classes into a JAR. This JAR is available as enrichment.jar
in the ejb-jdev-workspace\ejb\deploy
folder.