Integration

Salesforce Integration Using SOAPUI To Test Calls

In this blog, we will cover basic web calls testing with requests and responses using Salesforce. SoapUI provides capabilities to test and verify request and response messages before writing any code in c#, java or any other language. It is always recommended to test your calls with SoapUI before doing any sort of integration using any technology.

SoapUI is a tool to test various web calls or services. It can be used to test different kinds of WSDL and requests/ responses for the APIs.

Salesforce provides enterprise WSDL. If you have admin rights you can download it or please request Salesforce admin to download it for you.

Once you have that WSDL, open SoapUI and create a new SOAP project. Provide a project name and location of the downloaded WSDL

There are basically two steps to integrate with Salesforce – first, call the login() API by provided a valid username and password+token to retrieve SessionId and ServerUrl. SessionId and ServerUrl are important to invoke endpoint with structured request messages (it could be query(), create(), update() or upsert() etc.

Example login() API call

Goal: retrieve the SessionId and SessionUrl

In the project, you created go to login request 1 and provide valid username and password. The sometimes password needs to be concatenated like password+token. After providing the valid information submit the request

You should be then able to see the response. Copy ServerUrl and SessionId values. You need these values to make any further call. This is basically a way of authentication from Salesforce.

Example query() API call – Querying Salesforce records using SOQL

Go to query request 1 and open it. Edit its end point and enter the value you copied from ServerUrl in login() call. In the session, id tag provides SessionId value you copied from login() call. For your reference, I have copied request message below. Using a very simple SOQL query, I select top 10 Accounts with Id and name. Provide that query in the query string and then submit the call. You should be able to see the response in response windows.

Request message:

Conclusion:

In the same way, you can test any Salesforce API using the above-mentioned method. For more Salesforce soap API sample please visit Salesforce developer blog. You just need to modify those sample as per your requirement to test and validate them.

Author: Jahanzaib khan

Senior Integration Consultant

Email: [email protected]

Author

Hassan Askari