Pages

Thursday, April 26, 2012

Publish EDN JMS events from ADF BC

With ADF BC ( Business Components ) you can fire Event Delivery Network CRUD events from ADF BC entities which can be captured and handled by the Oracle SOA Suite. In this blogpost we will use the JMS implementation of EDN plus WebLogic Store and Forward for the reliable delivery to the SOA Suite server ( this way we can bounce SOA without effecting the Web Applications ).

To make this possible on a different ADF WebLogic server then the SOA Suite Server, we need to do the following steps.

First we need to add a WebLogic shared Library.  Copy the oracle.soa.fabric_11.1.1 and oracle.soa.workflow_11.1.1 folders from the SOA Suite Oracle Home (  Oracle_SOA1\soa\modules ) to your own WebLogic Middleware home. Put those two folders on the same level directory level.

Then we can add these jars to our own WebLogic Server. Go to deployments and add the following jar  oracle.soa.workflow_11.1.1\oracle.soa.workflow.wc.jar ( this contains a manifest which loads the other jars ). Target this shared library to the right WebLogic servers.



We need to add this shared library reference to the weblogic-application.xml deployment descriptor of the ADF Web application. This is the only place where it works ( WEB-INF/lib does not work )



Now we can create an EDN definition and add a publication to an ADF BC entity. Go the Business Events part of your entity editor.



We need to decide if we want to use EDN-AQ or EDN-JMS. The AQ implementation is the default EDN implementation but this requires some datasources to the soa-infra database. This can be Ok in a small server network but I don't want this dependency to this SOA Suite Server in my WebLogic Server. 

So I will go for the JMS implementation and create the required Queue and Connection Factories on my own WebLogic Server ( you can also do this with JMS Foreign Server ). 
Then those JMS message are stored locally and we will use WebLogic Store and Forward for the reliable delivery to the SOA Suite server. This way we can bounce the SOA Suite server without effecting our Web Applications.

For the EDN-AQ implementation read this blogpost. 

To enable the EDN-JMS implementation you need to do the following steps which are described in this blogpost. 

We need to create the following JMS artefacts.

Create a JMS Server with a file or jdbc persistence.
Create a JMS Modules with a sub-deployment targeted to this JMS server.

Create a JMS Connection Factory called EDNConnectionFactory with JNDI name jms/fabric/EDNConnectionFactory, disable XA and targeted this to your WebLogic server.

Create a JMS Connection Factory called xaEDNConnectionFactory with JNDI name jms/fabric/xaEDNConnectionFactory, enable XA and targeted this to your WebLogic server.

Create a Queue called EDNQueue with JNDI name jms/fabric/EDNQueue and use the subdeployment so its targeted to the JMS server.

When we start our ADF Web application and change some data, we can take a look at the Queue. Here we will see the EDN events.



Last step is to setup Store and Forward. For this we can follow this Middleware Magic blogpost. 

See this blogpost how to fire EDN events  from Java and OSB instead of ADF BC. 

cheers

Saturday, April 14, 2012

Retrieve or set a HTTP header from Oracle BPEL

With Oracle SOA Suite 11g patch 12928372  you can finally retrieve or set a HTTP header from BPEL. This patch comes with Patch Set 5 ( 11.1.1.6 )  and this patch can also be applied on PS3 ( 11.1.1.4 ), please download it from http://support.oracle.com

I made a simple test case with soapUI which adds an username and a message as HTTP header to the  service invocation.  In a second testcase I will mock this service in soapUI and BPEL will invoke this service and set an extra HTTP header property.

First step is to add a property to the binding.ws element of the service in the composite.xml. Add a property with name oracle.webservices.http.headers and as value the HTTP headers you want to use in BPEL
<property name="oracle.webservices.http.headers">username,message</property>


Next step is to define some BPEL variables for those HTTP Headers


In the receive activity of the BPEL process we can use fromProperty to copy the HTTP header property value to the BPEL variable. 

Do this in the BPEL source mode. 


Now you can use these variables in BPEL, I will use these vars in the return message.

Let's invoke the service from soapUI, we need to set the HTTP header properties with their values.



When we want to invoke a reference service and we also want to set some HTTP header properties.

We need also need to set the http.headers property on the binding.ws element on the reference in the composite.xml

<property name="oracle.webservices.http.headers">username,message,message2</property>


On the invoke of the reference service we need to use the toProperty and set the BPEL vars to these HTTP header properties.


When we test it again in soapUI we can see the invoke request of the soapUI mockservice, this contains the HTTP headers which we set in the BPEL process.


Wednesday, April 4, 2012

Deploy your ADF UIX applications to WebLogic

Just a quick blogpost how you can deploy your old ADF UIX ( 10.1.2)  applications to the WebLogic 11g ( 10.3.5 ) application server. Off course this is not supported by Oracle, who cares, your old 10.1.2 OC4J container is also end of life.  When it works, it works :-)

First you need to create a JDBC DataSource in the WebLogic Console.

You need to use the oracle.jdbc.OracleDriver driver class ( don't use XA, disable global commit ) else you will get some strange oracle BLOB errors.

Set Statement cache size to 0 ( in the connection pool Tab of the datasource )

also in the advanced options of the datasource you should de-select Wrap Data Types.
By default, data type objects for Array, Blob, Clob, NClob, Ref, SQLXML, and Struct, plus ParameterMetaData and ResultSetMetaData objects are wrapped with a WebLogic wrapper.


If you don't do this then ADF BC ( BC4J ) can't do its passivation in the ps_txn table ( this contains a BLOB datatype) and your applications behaves very strange
or you can set jbo.passivationstore to file


Next step is to make a shared library ( just use a war template ), For this I use an exploded folder so I can easily add and remove some jars.

I have a folder called adf.uix ( or a war with this name )

Folder META-INF
   File MANIFEST.MF with the following content

     Manifest-Version: 1.0
     Extension-Name: adf.uix
     Specification-Title: adf.uix
     Specification-Version: 1.0
     Implementation-Version: 10.1.2


Folder WEB-INF
  A empty web.xml file with the following content

     <?xml version = '1.0' encoding = 'windows-1252'?>
     <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"     "http://java.sun.com/dtd/web-app_2_3.dtd">
     <web-app>
     </web-app>
  
  Folder lib with all the 10.1.2 jars which I needed.



Deploy the shared library to WebLogic.

Next step is to unpack the war of your uix application ( we don't need the ear )

We need to create a weblogic deployment descriptor called weblogic.xml and put this in the WEB-INF folder. ( you can delete the orion one )

This weblogic descriptor contains a reference to our just created shared library. Also set the WEB-INF/lib as preferred classloading.


<?xml version = '1.0' encoding = 'windows-1252'?>
<weblogic-web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-web-app
     http://www.bea.com/ns/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd"
     xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
  <container-descriptor>
    <prefer-web-inf-classes>true</prefer-web-inf-classes>
  </container-descriptor>
  <library-ref>
    <library-name>adf.uix</library-name>
  </library-ref>
</weblogic-web-app>

This is the content of my WEB-INF/lib folder 




Zip everything to a new war file or use the exploded folder.

When you use jdk1.6 or higher you can set -Djava.awt.headless=true so cabo uix does not need X-Windows or Windows desktop to generate gif images.

And when you don't see the images then you should also use an exploded folder instead of a war so cabo uix has a file path to store the generated images. Or make an UIX configuration class which contains cabo paths to a folder of the weblogic server.

Deploy the war or exploded folder  to weblogic, test it and delete your own OC4J Container.