Connector Developer Program

Prerequisites

Prerequisites

Let us define the Business Objects for Salesforce REST using the webMethods platform.

  1. Knowledge of the Salesforce REST API information.
  2. Configure the Salesforce OAuth account. For more information on how to configure Salesforce OAuth, see this article.

Click here to download the Salesforce CloudStreams Provider project which will be used as an example in this tutorial.

To know how to import the Connector project into Designer CloudStreams Development, see Appendix.

The Package consists of the following:

  1. Connector for Salesforce REST v48.0.
  2. SaaS metadata resources, describeGlobal, and sobjectDescribe for fetching Business object list and its associated fields respectively. These resources are used in implementing the lookup services later.

Refer to the REST Connector documentation to know more about creating Connector and configuring resources.

1. Create Resource

This section explains steps to add a resource that has the dynamic signature.

  1. Open CloudStreams Providers view.
  2. From the left navigation pane, expand WmSalesforceProvider > salesforceService.
  3. Right-click Resources and click New Resource from the displayed menu.

Designer

The Create New Resource screen appears.

  1. Enter the details for Endpoint, Name, Path, and Methods.

    For example, sample values to add a new resource for the Create operation:
    Endpoint: Base URL (https://<instance>.salesforce.com )
    Name: Resource name (create)
    Path: Resource path (/services/data/v48.0/sobjects/{businessObject})
    Methods: HTTP methods (POST)

    Warning:- If you provide incorrect details, you might encounter errors while using the connector. Hence, ensure that the information specified is in accordance with the backend.

Designer

  1. Click Apply. The resource is created and added under Resources.

Note:- Invoking this Create resource adds a new record for the selected Business Object. Similarly, Read, Update, and Delete resources can be added to the connector.

2. Configure Create Resource

In order to use the resource created in the previous section, the resource must be configured with appropriate headers, parameters, request, and response payloads. This section explains the steps to configure a resource.

For more information, see Salesforce REST API documentation.

2.1. Adding Request Parameters

2.1.1 Double-click the Create resource available under DemoSalesforceProvider > salesforceService > Resources in the left navigation pane. The Create resource page is displayed.

2.1.2 Navigate to the Request > Parameter tab.

Note:- The path parameters are automatically added if they are provided in the resource path during resource creation.

2.1.3 To add any additional parameters, you can click Add.

2.1.4 [Optional] Click Add to add additional parameters. The Create Resource Parameter screen appears.

Designer

2.1.5 Specify what all fields must be entered.

2.1.6 Click Finish. The parameters are added.

2.1.7 Save the changes by pressing CTRL+S.

2.2. Adding Request Headers

2.2.1 Double-click the Create resource available under DemoSalesforceProvider > salesforceService > Resources in the left navigation pane. The Create resource page is displayed.

2.2.2 Navigate to the Request > Header tab.

2.2.3 Click Add. The Create Resource Header screen appears.

2.2.4 Enter the Header details as shown in the following image:

Enter the Name as Content-Type and Value as application/json.
Select Add resource header in all the resources, Enable editing and Required.

Designer

Click Apply. The Request Headers are added.

2.2.5 Save the changes by pressing CTRL+S.

2.3. Creating Document Types

This section explains the steps to add Doctypes for the Create resource. The doctypes are created in the following location of the Connector package from the Service Development perspective:
DemoSalesforceProvider > com.softwareag.cloudstreams.salesforce_v48.salesforceservice.doctypes

2.3.1 Create a Document Type representing the abstract signature that is replaced with real business entity fields at runtime.

a. Expand DemoSalesforceProvider package, right-click doctypes folder and select New > Document Type.

Designer

The Create a New Document Type screen appears.

b. Enter Document Type name.

Designer

Click Finish. The Document Type is created.

c. To add fields in the Document Type, right-click on the editor and click Insert > String from the displayed menu.

Designer

The Properties pane appears on the right side of the screen.

d. Update the field name as *any.

Designer

Click Save. The field is added.

2.3.2 Create a Document Type for request payload with reference to the abstract Document Type:

a. Right-click the doctypes folder from the left navigation pane and click New > Document Type.

Designer

The Create a New Document Type screen appears.

b. Enter the Document Type name.

Designer

Click Finish. The newly created Document Type is added.

c. To add fields in the Document Type, right-click the editor and click Insert > Document Reference from the displayed menu.

Designer

The Select screen appears.

d. Select the abstract Document Type created in the previous step.

Designer

Click OK. The fields are added to the Document Type.

Save the changes by pressing CTRL+S.

2.3.3 Create a Document Type for response payload:

a. Get the sample response from the backend API documentation and save it as a JSON file in the system where your Integration Server is running.

b. Right-click the doctypes folder from the left navigation pane and click New > Document Type.

Designer

The Create a New Document Type screen appears.

c. Enter Document Type name and click Next.

Designer

d. Select the Source Type as JSON and provide the file path of the sample JSON schema.

A sample JSON string for response is as shown below:

{
"id" : "015D0000000N3ZZIA0",
"success" : true,
"errors" : [ ]
}


Designer

Click Finish. The Document Type for response payload is created.

Save the changes by pressing CTRL+S.

2.4. Configure Request Body

This section explains the steps to configure the request body using the Document Types created in the previous sections.

2.4.1 Change the perspective to Cloudstreams Development.

2.4.2 Double-click the Create resource from the left navigation pane. The Create page appears.

2.4.3 Navigate to the Request > Body tab, right-click Payload > Document Reference.

Designer

The Document Reference screen appears.

2.4.4 Click Browse to select the doctype. The Select Document Reference screen appears.

2.4.3 Select createRequest under the doctypes folder.

Designer

Click OK. The Document Reference screen appears.

2.4.6 Click Finish to add the Request Payload.

2.4.4 Set request payload content type as application/json.

Designer

2.4.5 Save the changes by pressing CTRL + S.

2.5. Configure Response Body

This section explains the steps to configure the response body using the Document Types created in the previous section.

2.5.1 Navigate to the Response tab > Body tab, right-click Payload > Document Reference.

Designer

The Document Reference screen appears. Click Browse to select the doctype. The Select Document Reference screen appears.

2.5.2 Select createResponse under the doctypes folder.

Designer

Click OK. The Document Reference screen appears.

2.5.3 Enter the response code as 200-500.

Designer

Click Finish to add the response payload.

2.5.4 Set response payload content type as application/json.

Designer

2.5.5 Save the resource by pressing CTRL + S.

Tip:- For your reference, click here to download the sample Connector project created using the preceding steps.