Reference implementation


We have created reference implementation as sample project to show how to use/integrate OpenHub framework with specific integration project.

Implementation details

GitHub: https://github.com/OpenWiseSolutions/openhub-ri

Maven modules:

  • openhub-ext: routes and business logic implementation
  • openhub-war: WAR build
    <groupId>org.openhubframework.ri</groupId>
    <artifactId>ri-openhub</artifactId>
    <modules>
        <module>openhub-ext</module>
        <module>openhub-war</module>
    </modules>

Dependency on OpenHub framework modules:

Public services

There are the following public interfaces

Latest exchange rate (REST)

Service namelatest exchange rate for specified two currencies
TypeREST
Authentification-
URL

GET /http/exchange/v1/latest

Input parameters

URL parameters: ?source=EUR&target=CZK

  • source - source currency symbol, e.g. "EUR" 
  • target - target currency symbol
Output

text/plain

latest rate as number (Double)

Input routeorg.openhubframework.openhub.ri.in.exchange.ExchangeRestInRoute
Implementation

Uses output internal route org.openhubframework.openhub.ri.out.exchange.GetExchangeRateRoute that calls external service at http://fixer.io


Unit tests: org.openhubframework.openhub.ri.out.exchange.GetExchangeRateRouteTest

We use restito for integration tests of REST services, see org.openhubframework.openhub.ri.integration.GetExchangeRateIntegrationTest

Translate (Web Services)

Service nametranslates input text from/to specified language
TypeWeb Services
Authentification

HTTP Basic

# username and password for accessing web service of this integration platform by other systems
security.user.ws-user=wsUser
security.user.ws-password=wsPassword

Note: default from OpenHub framework

URL

WSDL /ws/translate.wsdl 

Input parameters
  • inputText - The input text to translate.
  • inputLang (optional) - The language of the source text, set to one of the language codes listed in Language Support. If the source language is not specified, the API will attempt to detect the source language automatically and return it within the response.
  • outputLang - The language to use for translation of the input text, set to one of the language codes listed in Language Support
Output
  • outputText - Translated text
Input route

synchronous: org.openhubframework.openhub.ri.in.translate.SyncTranslateWsRoute

asynchronous: org.openhubframework.openhub.ri.in.translate.AsyncTranslateWsRoute

Implementation

There are stub implementations for both routes (input parameters are logged for asynchronous message and some constant text is returned for synchronous message). Goal is to present concept how to create sync/async routes with web services ...

Unit tests: 

  • org.openhubframework.openhub.ri.in.translate.AsyncTranslateWsRouteTest
  • org.openhubframework.openhub.ri.in.translate.SyncTranslateWsRouteTest