Wednesday, July 22, 2009

Using Shared Object in Soa Suite 11g with MDS

Inspired by Eric Elzinga , who was wondering how MDS can work in Soa Suite 11g , I made some screenshots how you can use a XSD from a central MDS repository in your composite application. Clemens already blogged about re-using common metadata and he made a great ant utility to import or delete MDS files. For 11G R1 PS1 or higher use this instead of the Clemens utility
First I make a local MDS repository. If you install the Soa plugin you already have a seed folder in the integration folder. Under this folder create an new folder called apps. ( this have has to be apps else you will get a permission denied error ) . Under this apps folder we can create our own definitions.

To use my local SOA-MDS repository I create a new MDS File Connection

I want to re-use these common objects in every Soa project so I choose for the resource palette option

select the seed folder in the integration folder

Here we can see our common application objects.
Open the application resources window and open the adf-config.xml

Here we define a new metadata namespace with apps as path. And use the integration folder as metadata-path value.

We are ready to use these common objects in a mediator.. Here I will use a schema from the local MDS as input parameter for the mediator.

Import a new schema
Select the resource browser and here we can select our schema from the local MDS

I uncheck the Copy to project option, because this XSD already exists in the MDS

Our Project is ready but If we want to deploy this Soa project, we will receive a error, it can't find the schema. So we need to export the local MDS files to the SOA Suite database MDS.
To do this we have 2 options , the first option is to create a MAR deployment ( Application properties ) or do this with Ant.
I stripped the Clemens ant project so this ant build file has only two tasks , add and delete. It uses the adf-config.xml ( config folder) for the location of the target MDS and I use the local MDS as source.

Here is the target adf-config.xml which is located in the config folder

Change the so it matches your environment

This will import your local MDS object to the remote MDS. After this you can deploy your Soa Suite project.
Here you can download my ant project. Thanks to Clemens.

Tuesday, July 21, 2009

MDS repository for ADF 11G

With Fusion Middleware 11G the MDS repository plays a important role for ADF customizations and SOA shared objects. In this blog I explain how you can create a MDS database repository, deploy customizations to this MDS database and what you can do with MDS in the Enterprise manager website.

First we need to download the RCU repository creation utility and install a MDS repository in a Oracle Database.
Use a sysdba account

We only have to select the Metadata Services and provide a prefix

Next we need to install Weblogic with the Soa, Webcenter or Application development runtime extension. This extension gives us the Enterprise Manager website where we can configure the MDS repository. Select your Weblogic domain and select the MDS menu option.

Register the just created MDS repository. In my case I will call this repository adf

The EM website automatically create a datasource which we can use later.

If we have an ADF application with customizations and we deploy this to the Weblogic Server then JDeveloper detects the MDS repository

JDeveloper automatically creates a new MDS partition and uses your ear deployment name as partition name. It also uses the just created datasource to fill the MDS database. Just press deploy

When we go back to the EM website we can see the just created MDS partition.

The EM website also provides MBeans with some MDS operations.

For example we can query the partitions of a MDS repository.
When we select our just deployed ADF application and go to the MDS menu option, we can administer the MDS partition of this application.

We can export the MDS customization and import this to a different Weblogic server which has the same ADF application.
At last we can take a look at the MDS repository, here we can see that all the customizations entries are registered in the database. But the customizations xml are still located on the server, a bit strange I would suspect that with a MDS repository in the database that everything is loaded in the database.

Saturday, July 18, 2009

Using an EJB Service / Reference in Soa Suite 11G

With Oracle Soa Suite 11G ( FMW11G R1 ) we can finally use the EJB adapter. This adapter can be used as a service or reference. This means we can start a BPEL process by calling a EJB session method or use an EJB to lookup or change data. Using an EJB as service or reference is very cool because it is fast ( RMI ) and we can use the same EJB's ( Multi Tier ) for your Java Web applications and your composites ( Who needs the Database Adapter now?)
Here is a picture of the composite application with an EJB adapter as Service and Reference.

In this blog I will explain you first, how the SDO EJB is created and then how we use this as a Reference and as a Service

Create SDO Eclipse EJB
First step is to create an EJB entity with Eclipselink as persistence provider. For this example I used the Employees table of the HR schema. Next step is to create an EJB Session Bean.
Here is an overview of my EJB model project.

Select the Session Bean and generate a service interface on this

Now it goes totally wrong with the JDeveloper wizard 11G R1.

First step is fix the packages names of the SDO and SDOImpl classes, then we can refactor these classes and move it to the entities package. With this as result.

Select the session bean again and generate for the second time the service interface. Now we will get the WSDL.

Move the EJB WSDL and XSD to the Session bean package. With this as result.

Open the Entity XSD and change the target namespace and xmlns namespace to the same name as the package name in my case /nl/whitehorses/hr/ejb/entities/.


Open the XSD of the WSDL and import the entity schema and fix the namespace.
Change / to /nl/whitehorses/hr/ejb/services/ in every java, XSD or WSDL file

Create a Datasource to the HR schema in Weblogic and make sure you are using the XA Oracle Driver and target this Datasource to the Soa suite server.

Deploy the EJB to the Soa Suite instance.

Using the SDO Ejb as a reference in Soa Suite 11g
Open the composite application and drag the EJB adapter on the reference part of the composite.

Fill in the JNDI of the EJB on soa suite server , select the EJB jar and provide the Remote EJB interface class name.
Select the WSDL , Go the classes folder of the EJB model project and select the Session bean WSDL. This will copy the WSDL and the XSD to the local project folders and also import the jar. That's all , now you can invoke this in a BPEL process.

Using the SDO Eclipselink Ejb as a Service in Soa Suite 11g
We can use the same EJB as starting point of our composite application. This time Soa Suite only uses the interface and does nothing with the Session Bean methods.
Drag the EJB adapter to the Services side of the composite overview.

The Service ID is very important because we need this name in serviceFactory.createService, The rest is the same as in the reference part. Use this EJB Service in a BPEL process.

Now we only have to make a simple java class where we call this EJB composite service.

package nl.whitehorses.soa.ejb.service;

import commonj.sdo.helper.DataFactory;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;


import oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceFactory;
import oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean;

import oracle.jbo.common.sdo.SDOHelper;

public class callejb {
public callejb() {

public static void main(String[] args) {
try {
// very important to load every schema you use in the EJB
try {
SDOHelper.INSTANCE.defineSchema("nl/whitehorses/hr/ejb/entities/", "EmployeesSDO.xsd");
SDOHelper.INSTANCE.defineSchema("nl/whitehorses/hr/ejb/services/", "HrEmployeeEJBBeanWS.xsd");

} catch (Exception ex) {

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

// soa suite server
props.put(Context.PROVIDER_URL, "t3://localhost:8001");
InitialContext ctx = new InitialContext(props);
SOAServiceInvokerBean invoker = (SOAServiceInvokerBean)ctx.lookup("SOAServiceInvokerBean#oracle.integration.platform.blocks.sdox.ejb.api.SOAServiceInvokerBean");

//-- Create a SOAServiceFactory instance
SOAServiceFactory serviceFactory = SOAServiceFactory.newInstance(invoker);

// use the Service Id in the EJB service adapter
HrEmployeeEJB hrEmployeeEJB = serviceFactory.createService("EmployeeService", HrEmployeeEJB.class);

EmployeesSDO employeesSDO = ( EmployeesSDO )DataFactory.INSTANCE.create(EmployeesSDO.class);

EmployeesSDO resultEmployeesSDO = hrEmployeeEJB.persistEmployeesSDO(employeesSDO);

} catch (Exception ex) {


Here is the result of a EJB service instance.

Here the link to official EJB adapter documentation. ( This can be a lot better )
Download here the EJB project I used and here the Soa Suite project.

Monday, July 13, 2009

Using AQ ( JMS Text message ) in WLS 10.3.1

In Oracle Application Server 10.1.3 ( OC4J) you can use OJMS to expose AQ with JMS (text) Message as type and use it as a normal JMS Queue or Topic in Soa Suite or a Message driven Bean. See my previous blog for more details. With the release of Weblogic 10.3.1 ( WLS FMW11g ) we can do the same with a Foreign JMS Server. Before 10.3.1 we had to make a startup class to achieve this.
First create a Queue and Queue table with SYS.AQ$_JMS_MESSAGE as payload type in your Oracle Database and make sure you enable enqueue /dequeue on this Queue.
In Weblogic we have to create a JMS server and a JMS module.
Create a new JDBC datasource with a schema user which can enqueue or dequeue the just created queue. Use the XA JDBC driver, with this driver you can use global and local transactions. with NON-XA driver you can only use local transactions, this can be problem when you want to use this Queue in Soa Suite.
Select your JMS module in the WLS Console and create a new Foreign Server.
Open the Foreign Server so we can configure this AQ server.
Change JNDI Initial Context Factory to oracle.jms.AQjmsInitialContextFactory and we have to provide the jndi datasource name in the JNDI Properties field, For Example datasource=jdbc/scottDS

Create a JMS connection factory
As local JNDI name you can choose what you like. For Remote you have to choose one of these values. QueueConnectionFactory, TopicConnectionFactory, ConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory or XAConnectionFactory

Now we can create a new Destination.
As Local JNDI name you can choose any name but as Remote JNDI it needs to start with Queues or Topics after that add a / with the database queue or topic name.

We are ready to use this AQ Queue in a Soa Suite Composite application. Where we will use the JMS adapter.
Select Oracle Advanced Queuing as OEMS

and select the Foreign Server Destination.

For more Weblogic AQ JMS details see the official documentation.

Sunday, July 5, 2009

ADF web applications and Oracle Enterprise Manager a perfect match

In the release of Oracle Fusion Middleware 11g the old Enterprise manager website is back. And this EM website is the bomb for ADF web applications. ( Well done) . In FMW11g EM you can off course do the standard things like deploy and undeploy, but Oracle added some extra to this site. You can now the measure performance of your ADF BC applications modules, Servlets , Web application and Task Flows. Change or tune the BC4J config parameters , change MDS or security settings ( add WSM policies ) or change the endpoint of your web service client.
Too bad this EM website is not available in the internal WLS of JDeveloper 11g ( It can be handy for performance tuning).
But we can install weblogic 10.3.1 and add the ADF Runtime and EM website to this WebLogic Domain. For this we need to download Application Development Runtime

Create a new WebLogic Domain and enable the Oracle Enterprise Manager / JRF options

When you want to deploy your ADF application to this WLS server then you probably missing some java libraries. To solve this change your war deployment so the required jars are added to the web-inf/lib.

We need to deploy the ear and not the war else the adf connections and security settings are not deployed. You can only deploy the ear from the application menu.

Here is a picture of the EM website ( http://localhost:7001/em ) where we can see our ADF applications

Overview of the deployed ADF application.

we can go the ADF settings by selecting ADF menu option

Here we can see the ADF BC AM performance
Overview of the Task Flow performance

We can change the BC4J configuration properties.

My application has a web service client and here we can change the endpoint or add some WS-Security policies.

And off course see the total ADF application performance.