Table of Contents
- Service Specification creation
- Business Studio Service creation
- Adding the full Implementation
- Process Overview
- Activity :: check country code
- Activity :: check IBAN Checksum
- Response :: Mapping
- Implementation Source
- Testing
- positive Test
- negative Test
Service Specification creation
This Example shows a Banking Data Validation API can be easily implemented using TIBCO Cloud? Integration.
The first sample shows how to validate an 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 browse your Service Specification defined in your TIBCO Cloud Account.
Create an 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 validate 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, an XSLT Transformation is used with the REST IBAN as the input string.
Full XSLT to validate 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)
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 and execute your Testing against the real URL.
Positive Test
Use e.g. IBAN DE89370400440532013000
Negative Test
Use e.g. IBAN DE89370400440532013001 wrong checksum.
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now