Posts tagged ejb binding
Publish SOA Composite application as EJB to be invoked from Java applications using EJB Binding
Jun 14th
With the recent (April 2010) SOA Suite 11g R1 Patch Set 2 (11.1.1.3.0), several new capabilities have been added to the SOA Suite. One these is the EJB Binding. Or rather, an enhanced version of this binding. In previous releases, this binding was available to provide interaction with SDO enabled EJBs – based on a WSDL interface and XML messages. The PS2 release added full Java support to the EJB binding. This means that we do not have to concern ourselves with WSDL and XSD that maps to the Java interface we want to invoke or expose, nor with sending a XML based payload when we invoke the composite service. All we need is the Java interface that describes either the EJB that we want to invoke (for an EJB Binding Reference) or that we want to expose (for an EJB Binding Service).
Steps:
1. Create Composite like always
2. Create a Java Interface (and possibly Java domain classes or bean types describing the structure of the input and ouput of the methods on the EJB (that should correspond with the operations available in the Composite application)
package nl.amis.utilities;
public interface FilterAndTranslate {
public String translate(String input);
}
Note: steps 1 and 2 can be reversed; especially when you want to work according to the contract (or design) driven approach, that would probably be best.
Note: thusfar I have only been successful with a Java interface that only uses simple types (my own domain objects and beans prevented deployment of the EJB for some reason)
3. Create an EJB Binding in the Services lane, based on this Java interface. Specify the JNDI Name for this EJB. For example: FilterAndTranslateEJB
Calling an EJB from a SOA Composite Application using the EJB Binding based on Java Interface
Jun 13th
I am currently reworking Chapter 12 for the SOA Suite 11g Handbook. This chapter describes various types of interaction SOA Composite Applications can have with Java applications and components. Since the initial creation of this chapter – some 6 months ago – we have had the Patch Set 2 release of the SOA Suite. This patch set introduced some additional functionality in this particular area of the SOA Suite, including the EJB Binding directly based on a Java Interface rather than on an SDO service created for the EJB. While that last option did the job, it requires manipulation of the EJB that is to be invoked – to SDO enable it – and that was undesirable and sometimes even impossible.
This article describes about the simplest way to get going with the EJB Binding – Java based – in Patch Set 2 (11.1.1.3.0). Building on this example, you will probably find yourself able to do useful things with it.
The steps we will go through are:
1. Create the EJB that is to be invoked from the Composite application through EJB Binding. Make sure the remote interface is created as well.
2. Deploy this EJB (in this simple example to the same WebLogic Managed Server that is running the SOA Suite)
3. Create a new SOA Composite Application
4. Copy the remote interface to the SCA-INF/src directory (or copy a JAR containing that interface to SCA-INF/lib)
5. Create an EJB Binding Reference. Configure it to invoke the EJB created and deployed above; specify the Java Interface that describes the interaction
6. Create a Mediator that is wired to the EJB Binding Reference; create mappings from the input and output of the Mediator to the XML structure derived by JDeveloper from the Java Interface definition
7. Finish the composite application; from here on it is ‘business as usual’ since none of the other components in the applications are aware that the Mediator talks to something ’special’ like an EJB.



