Accessing SalesForce data using SOAP Service - SoapUi

Recently i was trying to figure out how to access SalesForce data from outside. I had two options either to use REST or use SOAP API for accessing the data. I tried both and these are my notes for accessing SalesForce Soap API using Soap client such as SoapUi.
  1. First thing that you would want to do is generate security token for salesforce. Follow these steps for generating security token
  2. Once you have security token, login into the SalesForce console to download the WSDL, Click on Develop -< API and you will see page where you can download all the WSDL's, Download the Enterprise WSDL
  3. Now create new SOAP Ui project using the Enterprise WSDL you just downloaded
    You will notice that it generates bunch of SOAP operations
  4. In order to use the SOAP API you will have to first send a login request to SalesForce and get sessionid once you have it you can use that for making subsequent calls. First call the Login service like this
    <soapenv:Envelope xmlns:soapenv="" 
    You should replace replacerwitheuserid with your userId (email id that you use for login) and also replace replacewithpassword with your password and use the security token that you got in email to replace replacewithsecuritytoken. Make a request and you will get a response which looks like this
    <soapenv:Envelope xmlns:soapenv="" 
                   <roleId xsi:nil="true"/>
                   <userDefaultCurrencyIsoCode xsi:nil="true"/>
                   <userFullName>Sunil Patil</userFullName>
    You will need the value of sessionId element and value of serverUrl in subsequent requests. so note it down
  5. Next assume that you want to execute query request that will give you list of all the contacts using SELECT Id, FirstName, LastName From Contact query, so use XML that looks like this for the soap request. Replace the replacewithyoursessionid with the sessionId that you got from the login request and also change the URL where SOAP request is made to value of serverUrl
    SELECT Id, FirstName, LastName  From Contact<
    You will get response with list of contacts


Andria BZ said...

Well post in recent day’s customer relationship play vital role to get good platform in business industry, Salesforce crm tool helps you to maintain your customer relationship enhancement.
Salesforce training in Chennai|Salesforce training institute in Chennai

sss said...

In many organizations today, resources are limited. A team might have the internal expertise to train others on a new system,but they might have several other priority projects to handle.For more details salesforce online training in hyderabad