Posts tagged ejb

Using the Oracle WebLogic Technology Adapters with custom Java – Message Driven Bean (MDB) triggered by File Adapter (part of the story)

Oracle’s product portfolio contains the Technology Adapters. A set of JCA Connectors that provide a bridge between various technologies – such as JMS, AQ, Database (SQL and PL/SQL), FTP and File System – on the one hand and the world of JEE on the other. The SOA Suite 11g and Oracle Service Bus leverage these adapters to connect to and from these technologies. For example: through the adapters, instances of composite applications can be instantiated through the appearance of a file on the file system or a new record in a database table. And, in the outbound direction: OSB and SOA Suite can call out to PL/SQL procedures, send messages to JMS Topics or an AQ queue and write files to an FTP server.

The technology adapters comply with the JEE standard specification of JCA (Java Connector Architecture). They are deployed as a special type of resource – JCA Adapter – on WebLogic Server. And they can be connected to custom Java components – in addition to their better known usage with SOA Suite and Oracle Service Bus.

I have tried to use the File Adapter in an inbound fashion to trigger a Message Driven Bean when a new file is received in a specific directory. This article describes my findings. And I have to warning: the story is not yet complete(ly successful).

Read the rest of this entry »

Invoke SOA Composite application through RMI as remote EJB (using binding.adf)

In a recent post I described how we can use the EJB Binding in SOA Suite 11g PS2 to invoke a SOA Composite application through RMI as a remote EJB. This interaction can be fully based on Java interfaces – no WSDL or XML required. However convenient that is, I have not yet been able to make it work for complex arguments or return parameters: methods that use simple types work fine, but using custom POJOs as input or return value did not result in a properly exposed EJB (even though deployment seems successful).

There is another way to invoke a SOA Composite as EJB via RMI. This other way is through the binding.adf binding type. The main difference with the inbound EJB binding is that we communicate in terms of XML (over RMI) with the SOA Suite’s generic Client API – and not directly to a service specific EJB. I was able to get this to work thanks to articles by Edwin Biemond (http://biemond.blogspot.com/2009/11/invoking-soa-suite-11g-service-from.html) and Changjae Lee (http://blogs.oracle.com/jaylee/2009/08/invoking_composite_from_javajs.html). They laid the foundation – and I adapted it for SOA Suite 11g R1 PS2.

The steps we go through:

Expose the Composite service through the binding.adf:

1. Create the SOA Composite application like you always do.

2. Duplicate the service with SOAP binding (binding.ws) and configure the clone as binding.adf (based on the same WSDL).

3. Deploy the composite with this new service of type binding.adf

Read the rest of this entry »

Publish SOA Composite application as EJB to be invoked from Java applications using EJB Binding

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

Read the rest of this entry »

Calling an EJB from a SOA Composite Application using the EJB Binding based on Java Interface

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.

Read the rest of this entry »

Rapid development of Rich JSF Web applications on top of EJB/JPA persistence (JSF on Rails – Demo 1)

 

Here you will find the first demo from my Devoxx 2008 presentation. It shows how you can rapidly create a rich web application based on Java Server Faces and EJB/JPA persistency using JDeveloper 11g and the ADF 11g framework. The presentation included below shows the steps one by one to create a rich web application. The JDeveloper 11g application can be downloaded as well. The end result looks something like:

it includes such features as: master detail tables with synchronization; column sort; run time column manipulation: resize, reposition and hide/show; popup with detailed context data; data driven, synchronized chart; accordion for better page real estate usage.

Read the rest of this entry »

EJB Dependency Injection of Session Bean Facade in JSF 1.2 on WebLogic 10.3 (JSF with JPA)

 

As I was preparing for my Devoxx presentation next Monday, I decided to look at the somewhat harder way of integrating a JPA based business tier into a JavaServer Faces web tier. The easy way – when using the ADF 11g framework in JDeveloper 11g is creating a Data Control for the Session Facade Bean. The Web Application can create data bindings for entities, entity collections and operations exposed in the Session Facade Bean that completely hide the injection or lookup details from the web tier developer. It’s the ADF responsibility to find the session bean and manage references to it.

However, if you do not use ADF, you need to establish the link between the Web Application and the JPA Business Service yourself.

The JEE 5 way of achieving this consists of a few simple steps – on top of the JPA entity definitions: Read the rest of this entry »