You are currently viewing How To Use SOAP API in Salesforce

How To Use SOAP API in Salesforce

Sharing is caring!

Salesforce’s pre-built applications offer robust CRM capabilities. Furthermore, Salesforce allows you to change the prebuilt applications to match your company’s needs. But, on the other hand, your company may have complicated business operations that aren’t supported by the current functionality. In this scenario, Salesforce Lightning Platform offers advanced administrators and developers a variety of options for creating unique functionality. This is where SOAP API comes into the picture.

You can create, get, delete, and update records using the SOAP API (Simple Object Access Protocol API). Any language that supports web services can utilize the SOAP API. Here are the features of SOAP API.

  • Relies on XML and Schema.
  • Strongly types messaging framework.
  • Operations and its XML structure of request and response defined.
  • Communicated through WSDL.
  • The underlying transport protocol can be sent over almost any protocol, server-side such as HTTP, SMTP, TCP, or JMS.

Steps To Integrate SOAP API In Salesforce

Step 1: Create a web service method on the server-side. Create a salesforce org instance using, which will act as a server where will create a web service method to generate the leads.

To expose SOAP services:

  • Create an Apex class.
  • Add Webservice method.
  • Complete your server logic.
  • Exposed as WSDL.

Step 2: Generate and share the WSDL with the client.

  • Login to the salesforce -> Go to Home page -> Click on setup gear icon -> Click on setup menu.

  • In the quick find box, search Apex classes.

  • Search for the Apex class and click on the WSDL option to generate the WSDL file.

  • Right-click on the page and save the file.

Step 3: Client generates apex class from the WSDL.

  • Login to the client Salesforce org or sign up for the new Salesforce instance that will act as a client org using
  • Go to the Home page -> Click on the Setup gear icon -> choose the setup menu.
  • Search the Apex classes in the quick find box.
  • Click on the button, i.e., Generate from WSDL.
  • Choose the WSDL you saved recently.

Step 4: Invoke SOAP call to the server.

  • Remote site setting.
    • Settings -> Remote Site Setting

  • Set Session – authentication parameter.
    • Login to the Server-org.
    • Setup -> Quick find -> API -> Choose WSDL file.

  • Edit the above WSDL with the text editor.
  • Find -> anyType and replace it with the string.

  • Go back to the Client org.
  • Generate the apex class from the WSDL file generated on the Server side.

  • Building Request Parameter.
    • Open the generated apex class i.e partnerSoapSforceCom.apxc in the client salesforce environment.
    • Create a Remote site setting for the below endpoint, which will be invoked for getting the session Id.

  • Generate security tokens from the server-side:
    • Go back to the server org.
    • Go to settings.

  • Click on Reset my security token.

  • Go to your email account and get the security token.

  • Copy the above security token and paste it with the password in the anonymous window.

  • Find the Login method inside the Soap inner class and utilize that method to get the session Id from the server.

  • Open an anonymous window to execute the login method and get the session Id.

  • Processing Response.

  • Execute the above script.
  • Go back to the server and search for the lead you created.


SOAP is widely used as a web service standard and is used in many internal systems worldwide. However, many firms are adopting a microservices architecture using REST APIs for new initiatives. While contemporary techniques abandon SOAP’s entirely standards-based approach, many people prefer the more flexible and agile development process.

Want to connect complex systems and automate business processes seamlessly? Leverage Salesforce Data Integration Services from Cloud Analogy and achieve enhanced operational control by building a unified view of your customer.  


Sachin Arora

Scrum Master and Principal Solutions Architect
Sachin, a renowned Scrum Master and Principal Solutions Architect at Cloud Analogy, has rich experience when it comes to working on process improvement in a fast-paced environment maintaining high level of quality in all deliverables. Sachin's expertise lies in varied hardware and software environments including Cloud technologies such as Salesforce, AWS, Cloud Foundry & Google App Engine and Mobile.

Hire the best Salesforce Development Company. Choose certified Salesforce Developers from Cloud Analogy now.

Leave a Reply

× How can I help you?