How to use Cumulocity and Salesforce Connector APIs on API Gateway

A CloudStreams provider contains connectors and services that can be used to integrate with software as a service (SaaS) provider. The CloudStreams connector contains SaaS provider specific information, such as how to connect to a provider and the default and custom groups that you can configure.  

This guide describes on the below topics in high level which are needed to use Cumulocity and Salesforce Connector APIs on API Gateway.

  1. Configure and use webMethods CloudStreams Provider for Salesforce.com  & Cumulocity on Integration Server 
  2. Create REST/SOAP services on Integration Server which perform some activity using the connectors configured
  3. Export the REST/WSDL descriptors from Integration Server as Json and WSDL files respectively
  4. Import the WSDL/JSON files on API Gateway to Create APIs on Gateway

1. Configure and use webMethods CloudStreams Provider for Salesforce.com & Cumulocity on Integration Server

a. Configure Salesforce.com Connectors on Integration Server

  • Install Salesforce and Cumulocity Provider packages on Integration Server which has WmCloudStreams package installed. (Attached Salesforce.com and Cumulocity provider packages)
     
  • Create salesforce SOAP connector with valid account details as shown below from IS Admin-> CloudStreams -> Salesforce.com -> Salesforce CRM -> Configure New Connection

 

Mainly below are the details which are required

  1. Package and Folder name on which the connectors to be created.
  2. Connection Name
  3. Salesforce server URL: Ex: https://login.salesforce.com/services/Soap/u/40.0
  4. Username and Password: <Salesforce account ID and Password>
  5. Type of authorization: <Usually we use ‘none’ as default>

Provide all the mandatory details and click on save.

  • Enable the created SOAP connector connection.

  • Create salesforce REST connector with valid account details as shown below from IS Admin-> CloudStreams -> Salesforce.com -> Salesforce Bulk Data Loader -> Configure New Connection

Mainly below are the details which are required

  1. Package and Folder name on which the connectors to be created.
  2. Connection Name
  3. Salesforce server URL: Ex: https://login.salesforce.com/services/Soap/u/40.0
  4. Username and Password: <Salesforce account ID and Password>
  5. Type of authorization: <Usually we use ‘none’ as default>

Provide all the mandatory details and click on save.

  • Enable the created REST connector connection.

b. Configure Cumulocity Connectors on Integration Server

  • Create Cumulocity connector with valid account details as shown below from IS Admin-> CloudStreams -> Cumulocity -> Cumulocity -> Configure New Connection

Mainly below are the details which are required

  1. Package and Folder name on which the connectors to be created.
  2. Connection Name
  3. Server URL: Ex: https://<instance>.cumulocity.com
  4. Username and Password: <Cumulocity tenant account ID and Password>
  5. Type of authorization: <Usually we use ‘none’ as default>

Provide all the mandatory details and click on save.

  • Enable the created Cumulocity connector connection.

2. Create REST/SOAP services on Integration Server which perform some activity using the connectors configured.

Cumulocity and Salesforce.com providers expose many connector services that can be used to do many activities. Salesforce.com connectors can be used for many operations like Create accounts, delete accounts, Get user info from salesforce etc. Similarly, Cumulocity connector services allow us to do many operations related to events, Inventory, Measurements, and Device Control, and so on. We can expose these connector services as REST or SOAP services and import those APIs on API Gateway.

This process will have different steps mentioned below.

  • Create Cloud Connector Service using the Connections available on IS and update the Cloud Connectors with required operations
  • Create flow service and use cloud connector service inside the flow service
  • Create REST/SOAP services by using the flow services
  • Create Cloud Connector Service using the Connections available on IS and update the Cloud Connectors with required operations

Cloud connector services can be created on Integration Server using Software AG Designer. Different cloud connector services can be created respective to connections present on Integration Server. This section will explain how the cloud connector services can be created for Salesforce.com and Cumulocity connections.

a. Create Cloud Connector Service for salesforce.com provider

  • Launch SoftwareAG Designer and connect to Integration Server where connections are configured and enabled.
  • Switch to Service development perspective (CloudStreams related plugins should be installed with the designer).
  • Create required packages and folders where the Cloud Connector Services to be created.

  • Right click on the folder and select New-> Cloud Connector Service.

  • Provide required service name and click Next. There will be a connector selection window, select salesforce SOAP connector and click Next.

  • Select the connection pool created on Integration Server and Click Finish.


 

  • This should create the connector service and open the resource details of the service.

  • Select the required operation from the operations tab. For creating the account on Salesfoce.com, select Create operation and click Next.

  • Select Account in the Select business object window and Click Next.

  • Select the Account related fields to update on Salesforce.com, Click Finish and Save the Service.

Note: Same process can be used create services for different operations of same connection pool or different connection pool.

b. Create Cloud Connector Service for Cumulocity provider

  • Launch SoftwareAG Designer and connect to Integration Server where connections are configured and enabled.
  • Switch to Service development perspective (CloudStreams related plugins should be installed with the designer).
  • Create required packages and folders where the Cloud Connector Services to be created.

  • Right click on the folder and select New-> Cloud Connector Service.

  • Provide required service name and click Next. There will be a connector selection window, select Cumulocity connector and click Next.

  • Select the connection pool created on Integration Server and Click Finish.

  • Select the service that will be used for the cloud connector service. To work with events of device on Cumulocity select Events.

  • This should create the connector service and open the resource details of the service.


 

  • Select the required operation from the Resource Name. For creating the event on device connected with Cumulocity, select Create a New Event resource and click Finish and Save the Service.

Note: Same process can be used create services for different operations of same connection pool or different connection pool.

  • Create flow service and use cloud connector service inside the flow service

Integration Server supports the creation of both SOAP and REST services on it. REST and SOAP services can be easily created on the Integration server if we have the flow services which do some operations.

Hence the cloud connector services can be called inside the respective flow services so that they can then use for the creation of REST and SOAP services accordingly.

a. Create flow service for Salesforce.com cloud connector service

  • Create required folders where the flow services to be created with cloud connector service.
  • Right click on the folder and select New->Flow Service.

  • Provide required service name and click Finish.

  • Right click on Canvas of created service and select Insert-> Invoke

  • Select the created Cloud Connector Service for salesforce.com provider and click OK.


 

  • Define the required inputs/outputs for the flow service from the inputs outputs tab and map it respectively in pipeline.

  • Save the service and run the flow service with inputs, the output should be generated successfully.

a. Create flow service for Cumulocity cloud connector service

  • Create required folders where the flow services to be created with cloud connector service.
  • Right click on the folder and select New->Flow Service.

  • Provide required service name and click Finish.

  • Right click on Canvas of created service and select Insert-> Invoke

  • Select the created Cloud Connector Service for Cumulocity provider and click OK.

  • Define the required inputs/outputs for the flow service from the inputs outputs tab and map it respectively in pipeline.

  • Save the service and run the flow service with inputs, the output should be generated successfully.

  • Create REST/SOAP services by using the flow services

Integration Server 10.1 supports REST v2 resource. The REST V2 resource can be created using the flow services available on Integration Server. Whereas the SOAP services can be easily created on Integration Server from the older releases of Integration Server as well. Below are the steps to create REST v2 resource and SOAP Services on Integration Server.

a. Create REST v2 resource for both Cumulocity and Salesforce.com cloud connector services

  • Create required folders where the REST v2 resource to be created with cloud connector service.

 

  • Right click on the folder and select New->REST Resource and select REST V2 and Click Next.

 

  • Provide the required service name and Click Finish.

 

  • Update the REST resource configurations with the appropriate flow service and URL by clicking on Add button.

 

  • Select required REST method and provide URL for the resource and Click OK.

 

  • Save the REST v2 resource and Validate that the flow service name appears under Mapped Services.

 

  • Create REST V2 Descriptor for the REST resource created by following below steps. The REST descriptors can be exported from designer and imported on API Gateway.
  • Create required folders where the REST v2 descriptors to be created with REST v2 resources.
  • Right click on the folder and select New->REST API Descriptor provide required name and Click Next.

..

 

  • Select REST V2 resource under Existing REST resource(s) and Click Next.

  • Provide the required title and Click Next.

 

  • Select the created REST V2 resource and Click Finish.


 

  • Copy the swgger definiations in to a empty text file and save it with .json format. This file can be then imported in API Gateway.

Repeat the same steps for creating the REST V2 resource and Descriptors for salesforce.com connector service by using respective flow service.

b. Create SOAP services for both Cumulocity and Salesforce.com cloud connector services

  • Create required folders where the REST v2 descriptors to be created with REST v2 resources.
  • Right click on the folder and select New->Web Service Descriptor provide required name and Click Next.

  • Select service descriptor as Provider, Web service source as Existing IS Service and Click Next.

  • Select the flow service for which the WSDL has to be created and Click Finish.

Repeat the same steps for creating the Web Service Descriptors for salesforce.com connector service by using respective flow service.

3. Export the REST/WSDL descriptors from Integration Server as Json and WSDL files respectively.

  • Open the created REST deacriptor and the Swagger details are visible under the Swagger tab of the opened REST descriptor.

  • Copy the swgger definiations in to a empty text file and save it with .json format. This file can be then imported in API Gateway.
  • SOAP service definitions can be seen from the WSDL tab of the created Web Service Descriptor.

 

  • Copy the Web Service definiations in to a empty text file and save it with .wsdl format. This file can be then imported in API Gateway.

4. Import the WSDL/JSON files on API Gateway to Create APIs on Gateway.

API Gateway itself provides multiple ways to create APIs on it. Since we have the exported files of respective SOAP and REST API files for Cumulocity and Salesforce.com connector providers, we can use the Create API from file option and save the APIs on API Gateway. Below steps can be used to have the Cumulocity and Salesforce.com provider APIs on Gateway.

  • Login to API Gateway as an Administrator and go to APIs page to create the APIs.

 

  • Click Create API button and use “Import API from file” option to create APIs on Gateway.

  • Browse the exported .json and .wsdl file one after other and provide the required name and version for the APIs and Click Create button.

Here on the APIs are available on API Gateway and all the functionalities of the Gateway can be used to Manage and Administrate these APIs.