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.
Author: pobalopalous
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:
- Comparison of characters must be in the same case. Don’t compare ‘D’ to ‘a’.
- 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.
Finding your SOA sweet spot
Quocirca is a UK based research and analysis firm that particularly focuses on the business impact of IT. In a recent article ‘SOA – Dead or Alive?‘, Clive Longbottom raises the issue faced by ISVs in selling SOA solutions. Not all SOA initiatives have to be strategic and at the enterprise level, which is where a lot of the bigger software firms are more comfortable making their pitch.
Reflecting this need for tactical SOA solutions to evolve into a strategic game plan, Oracle outlines a SOA Maturity Model which helps IT folks in these businesses to make the move to SOA. It clearly outlines how benefits can be achieved in incremental steps. There is even a useful survey tool available to help you identify the SOA profile of your own organisation. This is a great place to start understanding the business audience and to begin tailoring the messages around the benefits of SOA to the business where it is today.
Dice service working on WLS
As mentioned in a previous post the Dice service, which is my JAX-WS example for a cross platform service implementation, was not working on BEA WebLogic Servier v10. It turns out I missed a key part of JAX-WS & WLS documentation when putting the build script together. The guidelines in the WLS documentation states that the ant tasks need to have a type=”JAXWS” attribute set. Without this, WLS was treating the web service as a JAX-RPC one and that was the cause of the strange WSDL and the runtime exception.
The build-service target now looks like this:
So the only change is setting the type attribute to JAXWS. The WSDL generated for this service is identical to the one generated on Glassfish.