Following on from Simon Stoneâ€™s excellent article Expose your integrations to your organization as REST APIs using IBM Integration Bus and IBM API Connect , I describe step-by-step how to push configurations for REST APIs from IIB to an API Connect service hosted on Bluemix and receive requests via a Secure Gateway service which is also hosted on Bluemix.
The diagram below illustrates how REST requests can be sent from a client to IBM API Connect hosted in Bluemix and forwarded to IIB via a Secure Gateway. 4. The Secure Gateway service creates a secure tunnel between Bluemix and an on-premise installation like IIB.
Search for API Connect and then click on the API Connect icon. Once it opens, scroll to the bottom and click Create.
The API Connect service is now provisioned in your Bluemix space.
Now search for Secure Gateway and click on its icon. Once it opens, scroll to the bottom and click Create.
You now have a Secure Gateway service provisioned on your Bluemix space! You should see 2 services shown in your space, one for API Connect and one for Secure Gateway.
Click on Add Gateway:
Enter a name for your gateway and click Connect It
You should see the installer start.
On the fourth page in the install wizard, you are asked to enter values for the Gateway Id and Security tokens:
You need to copy the Gateway Id and Security tokens from the service details:
Now click Install and then click Close after it completes successfully.
Back in the Secure Gateway service, click on Add Destinations
Enter the name of your Integration Node as the Destination Name and provide your hostname and port, then click on Add Destination
The Destination is added. You can click on I’m Done.
The gateway is shown with a red cross until you have configured the client.
Create an ACL file and add the permissions for your host and port. For this demo, I have allowed all ports.
Edit this file:
C:\Program Files (x86)\Secure Gateway Client\ibm\securegateway\client\securegw_service.config
so that it points to your ACL file:
Open this folder in Windows Explorer:
C:\Program Files (x86)\Secure Gateway Client\ibm\securegateway\client
Double click on secgw.cmd to run it.
Enter y to use the config file
You now see your gateway has gone green
Click on the gateway. Then click on the settings button for your destination.
You need to make a note of the cloud host and port.
If you open your API Connect Service, you will see a Sandbox catalog.
The hostname of your API Connect service is in the URL:
Now we can push REST APIs to the API Connect Service on Bluemix and test them though Secure Gateway. In the IIB Web UI, select your Integration Service and click on ‘Push REST APIs to IBM API Connect’
Enter eu.apiconnect.ibmcloud.com and your use id and password for logging onto Bluemix. Click on Connect to IBM API Connect. You should see it connects successfully.
You should see your API Connect organization listed.
Add the name of the product that you want to create and specify Sandbox as the catalog.
Select the REST APIs that you want to push.
Enter the Cloud hostname and port that you copied from before from the Secure Gateway Destination details.
Click on ‘Push to IBM API Connect’
You will see messages confirming that the Product has been created, the APIs have been added to it and the Product has been staged.
If you look at the APIs in your draft workspace now, you will see that the APIs are shown:
If you select a REST API and click on Source, you can see that the target-url in the swagger definition for the REST API has the hostname and port of the Secure Gateway. When the API is invoked, the request will be directed to that host and port and then the Secure Gateway will route it to the destination that was added. This is shown in the screenshot below:
Select the Catalog and Product, click on Republish product and then click Next.
Select the Operation and invoke it.
The request is sent to IIB through the Secure Gateway and a response is sent back!
You may also be interested in: