Ballerina How to: Salesforce Connector

Create integrations that interact with the famous SaaS vendors in the market is crucial for any integration technology. For Ballerina-Lang it is extremely important, especially given the fact the the most of the organizations are living the hybrid IT, combining on-premises with cloud-based solutions.

Image for post
Image for post
Salesforce.com

This is a Service Example that shows you how you can do a basic searching in Salesforce:

Note: Create a dev account in SFDC is out of the scope of that post :)

Service that Invokes a basic Search in Salesforce

We created a Service called sfdc which contains a resource called querySalesForce.

As global access for any other resource, we had declared the following objects:

xml soapResponse;

xml[] headers = [];

string username = “edgarsilva@gmail.com”;

string password = params[0]; // your password+securitytoken generated by SFDC

salesforcesoap:ClientConnector sales = create salesforcesoap:ClientConnector(username, password, “https://login.salesforce.com/services/Soap/u/39.0", “1.1”);

In the querySalesForce Method, we invoke the query method from the pre-configured connector.

The execution is simple:

Image for post
Image for post
Result from Salesforce Query Execution
Image for post
Image for post
Ballerina Execution Runtime

Developer Experience

I've been using Idea Plugin, and that is a really good experience if you want to play a little with Ballerina-lang.

Image for post
Image for post
Developer Experience — Integrated Environment for Ballerina-Lang in Idea.

Conclusion

Keep your eyes opened and check how Ballerina-lang is evolving, and be ready for make your services and integrations to dance.

Written by

Just a dad, husband, and an Old-School Brazilian Jiu-Jitsu Black-belt. Skalena Founder, former WSO2, MuleSoft, Oracle, RedHat, Sun, Borland

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store