This sample demonstrates how to build a custom connector to an external (REST) API for further usage in webmethods.io Integration.
REST API used for this purpose is the HAFAS ReST API.
HAFAS is used by many international railway companies like e.g Deutsche Bahn, ÖBB, NS Nederlande Spoorwegen or SBB. Also by many public transport networks like e.g. RMV, HVV or BVG.
Developed by HaCon Ingenieurgesellschaft mbH, Hannover, Germany (https://www.hacon.de/en), the HAFAS ReST API access is usually established via registration at one of the HAFAS using providers.
This sample connector was developed with an API token/key provided by Rhein-Main-Verkehrsverbund (RMV). Registration can be done at https://opendata.rmv.de/site/start.html or finally at https://opendata.rmv.de/site/anmeldeseite.html
Base URL for all API calls is https://www.rmv.de/hapi/. You can find there all Web Application Description Language (WADL) service descriptions.
The connector contains the follwing actions
Connector Action | HAFAS Service |
---|---|
getLocationName | location.name |
getLocationNearbyStops | location.nearbystops |
getStationboard | departureboard |
getLocationName provides a free text search for Locations of different types, like e.g. (street) address or stop.
getLocationNearbyStops provides Longitude/Latitude coordinates based search mainly for stops.
getStationboard provides a search for the next departures of a given stop. Schedule based data, plus realtime data.
"HAFAS-only" example.
- Create HAFAS action getLocationName
- Create Connector Account, when using for the first time in webmethods.io project
- For an example, enter a desired value for "Search Input"
- Test the action, to get a valid output
- Create a second HAFAS action getNearestStop
- Map longitude and latitude between the two HAFAS actions
- Test the action, to get a valid output
- Create a third HAFAS action getStationBoard
- Map StopLocation's "extId" (not long "Id") to "Location Id"
- Test the action, to get a valid output
This connector could also easily be used for addtional processing of the "Connected Car" sample connector found here: https://github.com/SoftwareAG/wmio-connector-connectedcar
- Follow all steps in "Connected Car" README to get this connector deployed.
- Create a new workflow with a first action "getVehicles", no input needed.
- Test the action, to get a valid output
- Create a second action "getVehicleById"
- Map desired vehicle id between the two actions
- Test the action, to get a valid output
- Create third action "getLocation" (for vehicle)
- Map desired vehicle id between the two actions
These are the actions needed from "Connected Car", now let's find nearest stop of current vehicle's position:
- Create HAFAS action getNearestStop
- Map longitude and latitude between vehicle's "getLocation" and HAFAS "getNearestStop"
- Test the action, to get a valid output
optional, for illustration:
- Create a second HAFAS action getStationBoard
- Map StopLocation's "extId" (not long "Id") to "Location Id"
- Test the action, to get a valid output
Register for a free trial webMethods.io integration account: https://www.softwareag.cloud
TechCommunity Information could be found here: http://techcommunity.softwareag.com/pwiki/-/wiki/Main/webMethods.io%20Connector%20Builder%20guide
Product Documentation could be found here: https://docs.webmethods.io/integration/developer_guide/connector_builder/#gsc.tab=0
- Follow the official documentation until chapter "Quick Setup Guide", step 2 "Login to webMethods.io Integration".
- No need for "wmio init", as we start with this sample, cloned/checked out from Git.
# cd into cloned from Git directory "wmio-connector-hafas/src".
-
As you need to use your own API Key, replace all occurrences of "<your api key here>" with your own key.
-
Test your connector
wmio test
- Deploy your connector to webmethods.io Integration
wmio deploy
These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.
Contact us at TECHcommunity if you have any questions.