WSO2 ESB supports a rich set of Connectors which enabled it to seamlessly integrate with various third party services. WSO2 API Manager can be used to manage the API of the connector which is exposed via WSO2 ESB. The following describes the high level steps to expose the Open Weather Map connector added to WSO2 ESB via the API Manager.
What is described in this page is a high level use case of using a connector in the mediation flow, using an example. For in depth details and samples in using connectors, please see the documentation on WSO2 ESB and supported Connectors.
- Download the Open Weather Map connector from WSO2 Connector Store.
- Download the start the WSO2 ESB with a port offset of 1.
- Import the Open Weather Map Connector to ESB following the documentation on Working with Connectors via the Management Console.
- Create an account in Open Weather Map service, and obtain the API key as explained in Configuring OpenWeatherMap Operations.
Create a Rest API in WSO2 ESB which will initialize the Open Weather Map connecor and invokes it. The following sample sequence invokes the getCurrentWeatherForOneLocByCityName operation:
For the complete list of supported operations, please refer the documentation on Configuring OpenWeatherMap Operations.
- Expose this ESB API from API Manager, by creating an API in API Publisher and providing the ESB API as the endpoint.
Subscribe to the API created from API manager and invoke it. The apiKey should be the key obtained by creating an account in the Open Weather Map site. A sample payload is shown below: