By Amar Shah & Uma Korukonda
Enterprises consist of many endpoints, such as on-premise systems, cloud and mobile applications etc., businesses work better if these endpoints are securely connected.
Application Integration Suite V1.0 delivers a platform for hybrid integration and enables you to innovate faster to take advantage of changing customer needs and market trends.
Application Integration Suite offers the following products:
- IBM Integration Bus Advanced
- IBM API Connect Professional
- IBM WebSphere Cast Iron Hypervisor Enterprise Edition
In this article we show a scenario on how these products work together to form a API-led solution that enables you to easily and quickly connect environments that are comprised of cloud and on-premise applications.
Create an API for the Integration that returns the list of orders for a given customerId.
- Customer details are stored in backend SAP or Database system.
- Order details are stored in Cloud services Salesforce/Netsuite.
- Use IBM Integration Bus to create integration for interacting with backend SAP system. The integration flow in IBM Integration Bus is created as a REST Project so that it can be easily exposed as an API to API Connect.
- Use Cast Iron to interact with Cloud SaaS services like Salesforce.com
- The customer details retrieved by IBM Integration Bus from SAP are passed on to CastIron either using MQ or Http endpoints.
- CastIron connects to cloud service (Salesforce / Netsuite) using the cloud connectors available out-of-the box and fetches the order history for the given customer record.
- Information is returned back to IBM Integration Bus which in turn is responded back to the caller of the API.
- Push the REST API to API Connect using IBM Integration Bus Toolkit.
Note: The integration scenario described in this blog is primarily targeted for the situations where you may already have Cast Iron or IBM Integration Bus or both running and how you could create a hybrid solution to securely integrate on-premise and cloud applications. Finally we show how API Connect enables you to rapidly build new APIs by using integration technology.
We implement this solution in 3 steps.
Create a REST API project in IBM Integration Bus Toolkit by importing Swagger 2.0 document.
A Swagger document is the REST API equivalent of a WSDL document for a SOAP-based web service. The Swagger document specifies the list of resources that are available in the REST API and the operations that can be called on those resources. The Swagger document also specifies the list of parameters to an operation, including the name and type of the parameters, whether the parameters are required or optional, and information about acceptable values for those parameters. IBM Integration Bus supports version 2.0 of the Swagger specification.
In this particular example, you can see a GET operation. The input for this operation is customerId. The base URL for this rest API is highlighted as well.
The REST Project automatically creates a template for you with HTTP REQUEST and REPLY pair and as you start implementing each of the Operations from the imported JSON, it gets added as a corresponding subflow to the main message flow. As you can see below, getCustomer subflow represents the GET operation that we implemented.
For every operation and itâ€™s method type that has been imported from the swagger document, there is an â€˜Implement the operationâ€™ link . Upon clicking this link, a new subflow is automatically created and opened.
We describe the following two methods for integration between IBM Integration Bus & CastIron:
- Async communication using IBM MQ.
- Sync communication using WebService.
 Async communication using IBM MQ:
Implement the operation by adding any of the standard message flow nodes that are available with IBM Integration Bus to the subflow.
Information about the current operation is automatically placed into the local environment tree. You can use this information in your implementation if you want to determine which operation in the REST API was called, which HTTP method was used, the request path, or the request URI.
In order to implement Asynchronous communication style between IBM Integration Bus& Cast Iron , we must store the Request Identifier of the client so that when we receive the response back from CastIron, we can restore this identifier to reply back to the same client. Since the request and reply flows are different, we store this ID into a SHARED variable so that it is visible across the flows within the same Integration server.
This will drive the CastIron workflow. This is described in the section “Step 2: Implement the Cast Iron workflow to connect to cloud SaaS services”.
 Sync communication using WebService
In this style of implementation, we use use HttpRequest Node in IBM Integration Bus message flow to invoke the service in CastIron. This is illustrated as shown below:
After implementing the REST operations (GET method), the message flow design appears as:
As we discussed in above section, we illustrate the integration between IBM Integration Bus & CastIron in two ways
- Async mode using IBM MQ endpoints
- Sync mode using WebServices endpoints
[A] Async communication using IBM MQ endpoints
- In Step1 above, we retrieved the customer record from SAP and put that into an MQ queue.
- Start the CastIron workflow with MQ endpoint. Configure it to poll the message from the queue to which MQOutput node has put the message (TO_CI_SFDC).
- Use readXML activity to converts the data read from MQ queue in string format to the XML format using the Xml schema defined in the configuration so that it can be passed on to the next activity of the orchestration.
- Parse for account object and create an account in the SFDC using the details from the xml data above.This will return an id if the account creation is successful.
- Parse for Contract object to create a contract in SFDC. Use the account id created above as a input parameter for creating a contract object in the SFDC . If the contract is created in SFDC, then it will return a ID which then used for creating an order object in SFDC
- Use the account id and contract id created in the above activities and provide more details to create an order. If the order is created in SFDC , then it will return a ID which can be used to retrieve the details of that order.
- Convert the object record into XML and put that into an MQ queue using put Message activity.
Configuration of MQ endpoint
- Here we specify the Host, MQ listener , Queue manager and Queue details from where the CastIron workflow is going to read the messages from.
- Map input data to the fields in Saleforce to create Account object and create an Order record.
- Endpoint configuration to connect to Salesforce.com
- Map the data with the object in SFDC
- Retrieve the Order record and Salesforce and convert it to XML format and write back to an MQ queue.
- The output message from above CastIron MQ endpoint is now picked up by the IBM Integration Bus message flow which will drive the HTTP response flow as seen below.You can note that the Queue name in the CastIron workflow PutMessage endpoint is same as queue name for MQInput in IBM Integration Bus message flow.
- In the compute node , we then restore the RequestIdentifier so that the response is sent the correct client who had requested this service.
From this queue, the message flow in IBM Integration Bus will read the message and send it as a response to the requesting client.
This completes the integration between IBM Integration Bus & CastIron using MQ based connectivity.
[B] Sync mode using WebServices endpoints
The following figure shows the CastIron orchestration with endpoints Http Receive Request and Http Send Response. (We have replaced with MQ Poll and MQ put message activities in CastIron workflow with Http equivalents).
The configuration steps for Salesforce connectivity remain the same.
Deploying REST Project to Integration Node
The REST API project does not work with broker level http listener (which is a default setting for a newly created broker), so the deployment may fail. Hence, Modify the broker to use Execution Group level embedded listener.
-e -o ExecutionGroup -n httpNodesUseEmbeddedListener -v true
We now describe the steps to register Integration Bus REST API with API Connect.
Right Click the deployed REST API in Integration Server. The dialog box offers an option to push the REST API project to API Connect service.
The wizard automatically fetches the Organization details that you are registered with for your API Connect account. Select the Organization from the drop down list that you want the REST API to be hosted at and then Click â€˜Finishâ€™.
Click on the â€˜Editâ€™ icon as highlighted above. Under the implementation tab, Enter the proxy URL which the API Connect service will internally use to connect to On-prem system where IBM Integration Bus is running. If you are using a cloud hosted API Connect service, you may need to use the hostname/Port generated by the Secure Gateway.
Save the plan and Stage it to a â€˜Sandboxâ€™ environment. Once the plan is Staged successfully, go to the Management tab from the left side menu. For publishing the plan. The Publish menu appears on clicking the icon under Actions as highlighted below.
The dialog box offers you option to specify the visibility of the plan and the subscribers of this plan. For this scenario we use default options. When the plan is published successfully, the status gets updated as shown above.
After adding the Application, Click APIs tab at left side menu and click Select a Plan drop down list as shown below. Expand the Operations by clicking the sign under Details column to get the public URL generated by API Connect service.
This offering shows that how you can accelerate your integration creation and management for cloud and on-premise resources through the rich connectors and easy to use tooling. The capabilities of the products demonstrate how rapidly you can design APIs with essential security policies and share APIs across organizational boundaries and environments.
IBM Integration Bus v10.0.0.4 provides a ‘SalesforceRequest node’, which enables you to communicate with Salesforce.com to create, retrieve, update, and delete Salesforce records.
The SalesforceRequest node is available on Windows and Linux x64 systems, in developer mode and applicationIntegrationSuite mode. The detail information about this new capability and step-by-step procedure to configure Salesforce Request Node in IBM Integration Bus v10 is illustrated in the Blog :
Integrating with Salesforce using a REST API created in IBM Application Integration Suite 1.0