Oracle Lite and SOA Suite

The Oracle SOA Suite bundles a number of Oracle products (BPEL Process Manager, ESB, Oracle Business Rules and Web Services Manager) to provide complete set of service infrastructure components for building, deploying, and managing SOAs. For the windows platform it also comes with slimmed down version of Oracle Lite, an embedded database.

Why Oracle Lite?
Oracle Lite has a lot of great features including data synchronisation, device management, as well as support for SQL92 and ACID transactions amongst other things. It is the embedded relational database features that are used for the ‘basic’ installation of SOA Suite on windows. Antony Reynolds recently posted a great article on basic and advanced installation options which really puts an emphasis on the fact that Oracle Lite is intend to get you developing fast and not for production environments.

In the development environment the SOA Suite will use Oracle Lite under the hood and generally you don’t need to access this database. Of course, there are always the odd occasions when you do, such as tracing an error, or doing an upgrade.

Connecting to Oracle Lite
Over the summer a patch set was released to upgrade Oracle Application Server 10.1.3.1 (SOA Suite) to 10.1.3.3. The patch (#6148874) is available on metalink. The post installation steps involve running a database script. Since the SOA Suite is distributed with a slimmed down Oracle Lite there is no Mobile Client Workspace, i.e. webtogo web app, to manage the database, so the Mobile SQL Client is your easiest option.

Mobile SQL Client ($ORACLE_HOME\Mobile\Sdk\BIN\msql.exe) is used to connect to an Oracle Lite version 9 and upwards database. For earlier versions SQLPlus can be used. The version distributed with SOA Suite is 10.2.0.2. The usage is quite like SQLPlus:

msql system/manager@jdbc:polite:

For the SOA Suite there are three databases: orabpel, oraesb, orawsm. Connecting to the database used by Oracle BPEL Process Manager looks like this:

D:\msql system/manager@jdbc:polite:orabpel

Oracle Lite MSQL Version 10.2.0.2.0
Copyright (c) 1997, 2005, Oracle. All rights reserved.

Connected to: Oracle Lite ORDBMS
Database Name: ORABPEL (Read Write)
Database Version: 10.2.0.2.0
Auto Commit: off
Driver Name: oracle.lite.poljdbc.POLJDBCDriver (OLite 4.0)

SQL>

Alternatives
Another option to using Mobile SQL Client is to use Oracle SQL Developer a free graphical tool for database development. Just use the same JDBC connection properties that you can find in the Enterprise Manager, and ensure the olite*.jar files (in Mobile/SDK/bin) are in the classpath.

Summary
Oracle Lite is OK for a small SOA Suite development environment and even the slimmed down version that is distributed provides access to the databases via the Mobile SQL Client.

Custom XSLT functions in Oracle BPEL and ESB

In the Oracle SOA Suite there is a Custom XSLT function example. You can find it in bpel/samples/demos/XSLMapper/ExtensionFunctions. It is not immediately obvious that this approach of enabling access to static methods on a java class works for transformations in the ESB too. This is because both BPEL and ESB use the same Oracle XSLT processor.

The principle is simple:

To illustrate how straight forward this is I’ll go through an example that converts HEX to Decimal. So, with a class called xsltfunctions.HEX2DEC the namespace is defined in an XSL file as xmlns:sample = “http://www.oracle.com/XSL/Transform/java/xsltfunctions.HEX2DEC”.

The class HEX2DEC has static method called toDecimal:


public static String toDecimal(String hex) {
String dec = new BigInteger(hex, 16).toString(10);
return dec;
}

In the XSL file this method is invoked like this:

Note that the namespace prefix ‘sample’ is defined as mentioned earlier using the http://www.oracle.com/XSL/Transform/java/ combined with the classname.

So, you could compile the HEX2DEC class, add it to a jar and put that jar in /j2ee/home/applib so that any transform using the custom function in BPEL or ESB will work. It’s that simple.

All that’s left is to inform JDeveloper of your custom function so that you can easily refer to it in the XSL Mapper to do this you need to do two things:

  1. Create an XML file detailing the extension functions you have and tell JDeveloper about it in the “User Defined Extension Functions Config File” field of the XSL Map preferences (Tools->Preferences->XSL Map). This will list the functions in the User Defined Extension Functions section of the XSL Map component palette so you can drag and drop it into the XSLT at design time.
  2. Add the class to the JDeveloper classpath so that you can run the transform using the test feature with JDeveloper.

The extension functions XML looks like this:

To add the class to the JDeveloper classpath involves defining a JDeveloper extension. For JDeveloper 10.1.3.2 the extension needs to be a valid JSR 198 extension. Documentation on this can be found in /doc/extension/ide-extension-packaging.html.

Do this by defining a simple ‘extension.xml’ like this:

<extension version="1.0" esdk-version="1.0" id="xstlfunctions"
xmlns=”http://jcp.org/jsr/198/extension-manifest”&gt;
SOAStationXSLTFunctions
Peter O’Brien

The extension.xml (naming convention for these files) needs to be in the meta-inf folder of the jar containing the classes. The filename for the jar needs to be a combination of the extention id and esdk-version so in this case it would be xsltfunctions.1.0.jar. This jar should then be copied into the /extension directory.

Restart JDeveloper to pick up the changes for both the ‘User Defined Extension Functions Config File’ and the JDeveloper extension and you’re ready to go.

ABA Routing Number check digit validation

Following on from the IBAN check digit validation I decided to share some code to validate an ABA routing number. The routing number is a 9 digit number. Each digit is multiplied by a particular number (3, 7, or 1) depending on its position, the total added up and then divided by 10. The routing number is considered valid if there is no remainder. You can download the code and the test case.

Java IBAN check digit validation

The International Bank Account Number (IBAN) is an international standard for identifying bank accounts across national borders. It was originally adopted by the European Committee for Banking Standards, and was later adopted as an ISO standard (ISO 13616). Although currently only used in Europe, where it was adopted to facilitate cross border payments, it is anticipated that IBAN will a more global standard in a few years.

A quick search on the web for IBAN will show up information on the standard, including some web based validators. Since I could not find one, I have just put together a Java implementation of the IBAN check digit validation algorithm based on ECBS IBAN standard v 3.2. Code , including test cases, are available here. Please note that this works with the ‘electronic format’ (no spaces) of IBAN and not the ‘paper format’.

The code is reasonably straight forward, the challenge I had was to elegantly determine the appropriate numeric value of a letter as per section 6.3 (Alpha to Numeric conversion). In the end I found the simplest way was to compare the given character to ‘A’. This gave me the position of the character in the alphabet. Two key points though:

  1. Comparison of characters must be in the same case. Don’t compare ‘D’ to ‘a’.
  2. The position will start at zero. For example, E the fifth letter in the alphabet is at position 4.

Here is the code snippet for that:


private static int getAlphabetPosition(char letter) {
return Character.valueOf(
Character.toUpperCase(letter))
.compareTo(Character.valueOf('A')
);
}

Of course once you have the position of a letter in the alphabet don’t forget to add 10 to the result to get the numeric value as per IBAN standard.

In the implementation I have included an IBAN.properties which contains the lengths for all the country codes currently signed up to the IBAN initiative. You could take this forward by adding in the formatting patterns that exist for each country and include this in the validation too.

Differences between BPEL and ESB

Dave Berry (ESB Product Manager @Oracle) recently brought my attention to a discussion on the Oracle SOA Suite forum: Difference between Oracle ESB and BPEL. In short, the differences are in the problems they address. Confusion arises because there are similar capabilities in both. However, BPEL is about orchestrating business logic and ESB is about highly efficient integration.

The forum discussion is worth a read as there are useful contributions on which tool is right for what job, i.e. when to use BPEL and when to use ESB.