Setting up the SalesforceBulk Environment

The SalesforceBulk connector allows you to access the SalesforceBulk REST API from an integration sequence. SalesforceBulk is a RESTful API that allows you to either quickly load large sets of your organization's data into Salesforce or delete large sets of your organization's data from Salesforce.

Note: To work with the Salesforce Bulk connector, you need to have a Salesforce account. If you do not have a Salesforce account, go to https://developer.salesforce.com/signup and create a Salesforce developer account.

Salesforce uses the OAuth protocol to allow application users to securely access data without having to reveal their user credentials. For more information on authentication is done in Salesforce, see Understanding Authentication.

Obtaining user credentials

Follow the steps below to create a connected application using Salesforce and to obtain the consumer key as well as the consumer secret for the created connected application.

Salesforce Access Token Generation

First, we will create a Salesforce App (Connected App) and obtain the OAuth 2 tokens from Salesforce REST API.

  1. Navigate in to the Salesforce developer edition and create a Salesforce account.

  2. Log in to Salesforce after verifying your account, with the newly created credentials. In the upper-right corner, select Setup.

  3. Navigate to Apps > App Manager and click on the New Connected App.

  4. On the New Connected App page, fill the required fields as listed below.

    • Fill in Connected App Name, API Name, and Contact Email under Basic Information.

    • Go to API (Enable OAuth Settings), and select Enable OAuth Settings.

    • In the Callback URL field, enter https://login.salesforce.com.

    • In the Selected OAuth Scopes field, select the following:

      • Access and manage your data (API).
      • Perform requests on your behalf at any time (refresh_token, offline_access).
      • Provide access to your data via the Web (web), and then click Add.
  5. Click the Save button to save the new Connected App.

  6. Navigate to Connected Apps (Apps > App Manager) list, and click the App that you have just created, and then click on View.

  7. Go to API (Enable OAuth Settings), and note down the Consumer Key and Consumer Secret.

  8. On the page that opens, click the Edit button. Under OAuth policies, select All users may self-authorize in the Permitted Users list, and then click the Save button.

  9. Now we have to obtain the access token and refresh token as indicated below. Enter the following URL in your web browser. should be replaced with your instance name, in my example it is ap17.

    https://<INSTANCE>.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<CONSUMER_KEY>&redirect_uri=https://login.salesforce.com

    If this is a new browser, you will need to verify the account again with a code sent to the email, and login to the account. It will be redirected to a URL similar to the following.

    https://login.salesforce.com/?code=aPrxYXyxzkuBzbiNknnlq2OFfWuX.EU66JOpBnNb_.rLpGZu.FdWAZXvDF6PtpoNWUjnrjYX8g%3D%3D
  10. Note down the value of the code. In my case, it is:

    aPrxYXyxzkuBzbiNknnlq2OFfWuX.EU66JOpBnNb_.rLpGZu.FdWAZXvDF6PtpoNWUjnrjYX8g%3D%3D
  11. Now import the following in POSTMAN and obtain the tokens.

    curl --location --request POST "https://ap15.salesforce.com/services/oauth2/token?code=aPrxYXyxzkuBzbiNknnlq2OFfWuX.EU66JOpBnNb_.rLpGZu.FdWAZXvDF6PtpoNWUjnrjYX8g%253D%253D&grant_type=authorization_code&client_id=3MVG9G9pzCUSkzZtNiO9KrUineTIaJzO7xLokQLSZ7Xb8mnRgsMC.J6EZNQ9lA.HIxMg7LRmCpxdH.mnU_1au&client_secret=37E2B8478E8C6ADBFB4045466CCB98AA067CE9D8D8A4E3F17D2440B13F046740&redirect_uri=https://login.salesforce.com" \
    --header "Accept: */*" \
    --header "Accept-Encoding: gzip, deflate" \
    --header "Cache-Control: no-cache" \
    --header "Connection: keep-alive" \
    --header "Content-Length: 0" \
    --header "Host: ap15.salesforce.com" \
    --header "Postman-Token: 7d68f566-7907-443d-9cbc-f5a7205ff1af,7239d98b-8020-47cc-9922-595ef03c676c" \
    --header "User-Agent: PostmanRuntime/7.19.0" \
    --header "cache-control: no-cache"
  12. Once it is imported, you will have the following in POSTMAN. Replace the following fields with your values.

    • code
    • client_id
    • client_secret

Configuring Axis2 configurations

Be sure to add and enable the following Axis2 configurations in the <PRODUCT_HOME>/conf/axis2/axis2.xml file.

  • Required message formatters
<messageFormatter contentType="text/csv" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="zip/xml" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="zip/csv" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="text/xml" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>
<messageFormatter contentType="text/html" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/> 
  • Required message builders
    <messageBuilder contentType="text/csv" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
    <messageBuilder contentType="zip/xml" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
    <messageBuilder contentType="zip/csv" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
    <messageBuilder contentType="text/xml" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
    <messageBuilder contentType="text/html" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>
Top