Monday 7 June 2010

Create Sensor and Sensor Actions in Jdeveloper 11.1.1.x

One small change between Jdeveloper 11.1.1.x and 10.1.3.x is different views for updating a bpel file vs setting up sensors for the same.

When we open the bpel file, there is a dropdown at the right side. Select Monitor to create or update sensor and sensor actions.


Sensor and Sensor Actions can be created in the Structure Pane.
Create a Variable Sensor “AuditMessage_Sensor”.


Then create a sensor action “PublishToAuditTopic” to publish the sensor data to the JMS topic “jms/db/AuditTopic”. This JMS topic has been previously configured on the weblogic server.



The Sensor action is configured in the following manner to publish the data to the JMS topic jms/db/AuditTopic.

Assign a bucketset to the output variable of a Business Rule Decision Function

To assign a bucket set to the input variable of a business rule decision function, we can do the same while creating the rule itself. But to assign a bucketset to the output variable, we need to update the fact of the output variable.
1. Open the rules designer
2. Click on Facts.
3. Select the output variable for which we need to assign a bucketset.
4. Click on Edit.
5. In the list of Bucketset, select the appropiate bucketset and click OK.

Now in the rule, in the Actions part, when we assert or modify the output variable message, we should get the bucketset as a dropdown.

How to replace urls and any other text in multiple files

Usually we encounter scenarios where we need to change urls or something else to ensure the composites work in other enviroments as well.
One easy way I managed to do this was by using notepad++. http://notepad-plus-plus.org/

It gives the capability of doing a "Find in files" and then we can replace anything requried at a any folder level.

JDeveloper hangs while using Expression Builder in Assign

Using the Expression Builder to build XPath expressions may cause Oracle JDeveloper to hang. If that happens, perform the following steps:
1. Kill the Oracle JDeveloper process.
2. Restart Oracle JDeveloper.
3. Select Tools > Preferences > SOA, and deselect the Validate Expression checkbox.
After performing these steps, Oracle JDeveloper should no longer hang.

Thursday 20 May 2010

Replace endpoint URLs in SOA Composites before compilation

The configuration plan doesnot allow to change endpoint URLs in XSLT artifacts. We tried to hack the ant-sca-deploy and managed to use Ant tokens to replace endpoint URLs in all the files in the composite.
The ant-sca-package copies the composite to a tmp dir and then compiles it. In between this we use

<echo>About to find/replace the endpoint URLs in the Composite Package</echo>
<replace dir="${tmp.dir}" value="${server}:${port}">
<replacetoken>devServer:7001</replacetoken>
</replace>

Thus, the jar file created contains the endpoints of the target server which is now compiled and then deployed avoiding any issues with dependant partnerlinks and refernced schemas.

This is the snapshot of the ant-sca-package.xml file

<target depends="scac-validate" name="package">


<available property="compile.source" type="dir" file="${src.dir}">
<antcall target="compile-source">

<property name="tmp.dir" value="${compositeDir}/dist"></property>
<mkdir dir="${tmp.dir}">

<copy failonerror="false" todir="${tmp.dir}" includeemptydirs="false">
<fileset dir="${compositeDir}">
<exclude name="classes/**">
<exclude name="deploy/**">
<exclude name="dist/**">
<exclude name=".designer/**">
<exclude name="**/*.jpr">
<exclude name="**/*.ear">
<exclude name="**/*.zip">
<exclude name="**/*.war">
<exclude name="**/*.jws">
<exclude name="**/*.bin">
</fileset>
</copy>

<replaceregexp file="${tmp.dir}/composite.xml" replace="'revision=" match="revision=&quot;(.*)&quot;revision='(.*)'">

<copy failonerror="false" todir="${tmp.dir}/SCA-INF/classes">
<fileset dir="${compositeDir}/../.adf">
<include name="META-INF/**">
</fileset>
<fileset dir="${compositeDir}/../src">
<include name="META-INF/*">
</fileset>
</copy>

<echo>tmp.dir: ${tmp.dir}</echo>


<echo>About to find/replace the endpoint URLs in the Composite Package</echo>
<replace dir="${tmp.dir}" value="${server}:${port}">
<replacetoken>devServer:7001</replacetoken>
</replace>


<jar destfile="${deploy.composite.name}" basedir="${tmp.dir}">

<delete includeemptydirs="true" deleteonexit="true">
<fileset dir="${tmp.dir}" includes="*/**">
</delete>
<delete dir="${tmp.dir}">
</target>

<target name="compile-source" if="compile.source">
<echo message="deleting contents of ${sca-inf.classes.dir}">
<delete failonerror="false" includeemptydirs="true">
<fileset dir="${sca-inf.classes.dir}" includes="*/**">
</delete>
<mkdir dir="${sca-inf.classes.dir}">
<javac debug="true" destdir="${sca-inf.classes.dir}" classpathref="scac.tasks.class.path" srcdir="${src.dir}">
</javac>
</target>

Working with Transactions in Oracle SOA Suite

Some good blogs which talk about working with transactions in Oracle SOA Suite. http://www.oracle.com/technology/architect/soa-suite-series/wli-bpel-transactions.html http://blogs.oracle.com/soabpm/2009/08/soa_suite_11g_-_transactions_b.html

Invoking a Secured Webservice from a BPEL 11g process.

We can invoke a secured webservice from a bpel process by adding the binding properties in the composite.xml. Where as in BPEL 10g, we used to set it in the partnerlink‘s properties.
Invoking a web service which is secured with WSS Username Token
• Create a bpel process in 11g Jdeveloper
• Add a partner link and enter the wsdl location of the secured webservice
• Open the composite.xml from the Application Navigator
• Right click on the external reference service and select “Configure WS policies”
• Under the security tab, click add button and select “oracle/wss_username_token_client_policy”
• Now Open the property Inspector window and click the add button under “Binding properties” tab.
• Include the “oracle.webservices.auth.username” and “oracle.webservices.auth.password properties.

Enable Instance State for SOA Composite

When we install the Oracle SOA Suite 11g, the state of the composites is always shown as a "?". To enable the server to show the proper status,
1. Right click on soa_infra
2. Go to Common Properties.
3. Check "Capture Composite Instance State."

Database Schema names in xsd files created by database adapter.

We were facing a problem where when we invoke a stored procedure using a DB Adapter, the xsd file created for the adapter contained reference to the database schema. This was because we are using PLSQL Object and Table types. Object types are used inside a table types and table types can be used as an array.
But this becomes an issue when we need to move to a different environment where the database schema name will be different.
For e.g in the dev environment the xsd file contains db:DEVSCHEMA.EMP_TAB and in the test environment it will be db:TESTSCHEMA.EMP_TAB.
But this was causing an issue when deployed to a different environment as it was giving a conversion error of the table types to a Java type because of the schema name.

To get around this,
1. While using a DB Adapter, try to use the DEFAULT_SCHEMA option as much as possible.
2. If Schema references are created, go to the xsd file and remove them. For e.g db:DEVSCHEMA.EMP_TAB will be db:EMP_TAB.
3. Validate the xsd file to check if everything is working.
4. Check the JCA file if it has a database schema reference and remove it.
It should now work in all environments.

Cannot call commit when using distributed transactions.

While testing some BPEL Process we encountered the following error in the DB Adapter call:

Exception occured when binding was invoked. Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'SP_CreateCaseData' failed due to: DBWriteInteractionSpec Execute Failed Exception. unknown failed. Descriptor name: [unknown]. Caused by java.sql.SQLException: Cannot call commit when using distributed transactions. ". The invoked JCA adapter raised a resource exception. Please examine the above error message carefully to determine a resolution.


To resolve this, go to Deployments on the weblogic console and open DBAdapter. Go to Connection - Outbound Connection Pool where the jndi is configured to talk to the jdbc data source.
Expand the javax.resource.cci.ConnectionFactory and select the appropiate Connection. There we can see that the data source name is configured in the dataSourceName row while it should be configured in the xaDataSourceName row. This is because the datasource is defined as XA.