How to Create a SOAP Service in Salesforce

Trey AroseSalesforce, Technical TipsLeave a Comment

How to Create a SOAP Service in SFDC

Salesforce provides a powerful SOAP toolkit that developers can leverage to connect their services to their enviromnet. In this entry we are going to show you how to create your SOAP service within

First you will need to establish your Web Service logic. This can be done by creating a new Class in

Below is an example that will create a new Account when called:

global class AccountPlan{

       //Define an object in apex that is exposed in apex web service

  global class Plan {

  webservice String Name;

     webservice String aId; //Value Returned to Initial System


   webservice static Plan createCasePlan(Plan vPlan) {


       //A plan maps to the Account object in

      //So need to map the Plan class object to Account standard object

      Account a = new Account();

      a.Name = vPlan.Name;

      insert a;

      vPlan.aId = a.Id;

      return vPlan;



The next step you’ll need to do is add your Web Service to a remote Site. To do this you can follow these steps:

  1. Navigate to Your Name | Setup | Develop | Sites  
  2. Click the name of the site you want to control.
  3. Click Public Access Settings to open the Profile page for your site profile and navigate to Enable Apex Class Access options.

Now we will enable the AccountPlan Apex Class we created earlier.



Once you have the class created, and added to your remote site, you can use built in Salesforce functionality to generate the wsdl. This wsdl will need to be passed to the server that is going to make the Web Service Requests.


You can Right Click and choose ‘Save As’ to download the appropriate wsdl file. That’s it! You have now successfully initiated a Web Service.


Leave a Reply

Your email address will not be published. Required fields are marked *