How to consume Salesforce SOAP web services

Salesforce provides a very good feature to connect Salesforce with third party applications for extended use. Suppose a company requires a website on WordPress or a Mobile Application, then using Salesforce SOAP web services you can bind third party applications with Salesforce to perform CRUD ( Create, Read, Update & Delete) operations.

Salesforce has ready to use plugins for mostly platforms like Android, iOS, PHP etc which user can download from Salesforce website and can connect with the platform. But if you want to use SOAP web services directly in your application then you can simply download the WSDL file from salesforce and connect with your application to start accepting data. Today i am going to share a small demo on how to start using Salesforce SOAP web services using a free tool SOAP UI. For your programming language you can check for the best solutions to consume wsdl file.

Steps to consume Salesforce SOAP web services :

  1.  Login to Salesforce and go to Setup from top right corner.
  2.  In Quick Search, search for API.
  3. Select API option under Build -> Develop.
  4. Now it will ask you the type of WSDL you want to consume (Enterprise, Partner, Apex, Metadata etc). Enterprise is mostly used for developing application that will consume data from your salesforce instance, partner is used for developing application that will work for multiple organisation etc. 
  5. Select Enterprise for this demo but you can use any as per your requirement. On next page click on Generate button which will download the wsdl file on your system.
  6. Once done you can open this wsdl file using notepad or any other document reader. The wsdl file looks like :which is basically a XML file containing schema of your objects that is there in your salesforce.
  7. Now we need to use this wsdl file in SOAP UI application. For that download SOAP UI ( and install it on your system.
  8. Create a New SOAP Project from File -> New SOAP Project. In that browse for the wsdl file you downloaded from Salesforce and give a name to this project. Once done click on OK.
  9. This will create a new project with all the SOAP methods with which user can consume data as per the requirement.
  10. From the list of methods, we can choose any method that fits our requirement like delete, create, describeSObject, describeAllTabs,query etc. For this demo i am going to use query for running a SOQL Query.
  11. Before running a SOQL Query we need to authenticate ourself with our salesforce login id and password, for that we need to use login method of wsdl to login. From left side panel, select login request.
  12. In that Login method we need to pass username, password & security token in body without any header data.
  13. In the response you will get serverUrl & sessionId which is required for executing wsdl methods to get data from salesforce instance.
  14. Now let’s start with running a SOQL Query using SOAP API.For this demo I will retrieve Account records from Salesforce Instance. For this we need to use another method of wsdl file that is “Query” which is used to run a query on salesforce.
  15. In query method request we only need to set sessionId (which we got from login request) in header and in body we need to write SOQL Query in queryString tag which we want to execute. Also the URL to which we are sending request needs to be changed to the serverURL (which we got from login request). Once you execute this, it will give you response will Account records.

Note : I am also sharing one Salesforce Trailhead link for the same (LINK )

Be the first to comment

Leave a Reply

Your email address will not be published.