step by step building a IBAN validation Service in TIBCO Cloud™ Integration

Last updated:
11:54pm Aug 26, 2019

Service Specification creation

This Example shows an Banking Data Validation API can be easily implemented using TIBCO Cloud™ Integration.
First sample shows how to validate a IBAN Number.

Use of Specification Designer to define the Service Request, here a REST Get with one parameter the IBAN.

Use of Specification Designer to define the Service Response, here if valid or not as boolean and JSON Response.

Business Studio Service creation

You can create a tiny Services Mock from TIBCO Cloud Integration itself, but here we create it directly using TIBCO Business Studio,
as will complete it fully functional in a next Step. 

Open Business Studio locally and browser your Service Specification defined in your TIBCO Cloud Account.

Create a empty new Business Studio Project and copy the Service Specification to the Services Descriptors Folder using drag'n drop

From Services Descriptors Folder you can drag'n drop your Service Description directly to the Service Implementation.

To be able to deploy the project now as Mock, we can add a dummy Response with always "true"

Adding the full Implementation 

Process Overview

the Implementation checks first for valid country Codes in the first Activity,
as a next step the IBAN checksum gets validated, followed by a Log Activity and the final Response.

All fully graphically defined using same tiny mappings.

Activity :: check country code

To validated the wanted country Codes a Mapper Activity is used together with a simple XML Schema.

The Valid Country Codes are defined as Module Properties, here: "DE|FR|GB|IS|IT|ES|NL"

Activity :: check IBAN Checksum 

For the Checksum Validation a XSLT Transformation is used with the REST IBAN as input string.

Full XSLT to validated the IBAN string checksum.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:local="http://localhost/">
	
	<xsl:template match="IBAN[local:validate(.)]">
        <xsl:text>Validated IBAN</xsl:text>
    </xsl:template>
	
	<xsl:function name="local:validate">
        <xsl:param name="pIBAN" as="xs:string"/>
        <xsl:sequence select="xs:integer(
                                 codepoints-to-string(
                                    for $n in string-to-codepoints(
                                                 concat(
                                                    substring($pIBAN,5),
                                                    substring($pIBAN,1,4)))
                                    return if ($n > 64)
                                           then string-to-codepoints(
                                                   string($n - 55)))
                                           else $n
                                 )) mod 97 eq 1"/>
    </xsl:function>
</xsl:stylesheet>
 

Response :: Mapping

As the XSTL activity gives a String back to the Process, this get's changed to valid boolean true/false in the final activity.

Implementation Source

Attach the Services Specification Input files, and Business Studio Project Export, too. (see end of this page)

Note

Services validate current only the checksum, and no other country specific IBAN configurations like the String Length, etc.

Testing

The deployed Application can be tested by just using the "Push to Cloud" Wizard directly online.
Or you follow the steps here, to execute some local debugging upfront.

... looks in TIBCO Cloud Integration like this, here with one running Instance:

For Testing you can just click on the Endpoint an execute your Testing against the real URL.

positive Test

Use e.g. IBAN DE89370400440532013000

negative Test

Use e.g. IBAN DE89370400440532013001 wrong checksum.