function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
fundooMentalfundooMental 

How can I call Web Services from one salesforce org to another

I have two salesforce developer accounts and I create a class with web service method in one of the developer org and want other developer org to invoke this class method using the SOAP Web Service. How can I achieve it?

To put it again: How can the web services in one developer org ( or any salesforce org) can be consumed/used/invoked by other developer org?

I am kind of new to web services but needs a heads up like how to get started.

Best Answer chosen by fundooMental
Shashikant SharmaShashikant Sharma
You should do:
  1. Create a Soap Webservice in one of your org ( ORG1 )
  2. Generate WSDL of this webservice
  3. GEt Enerprise WSDL 
  4. Go to another org ( ORG2 )
  5. Go to Apex Classes an Click button "Generate from WSDL" using WSDL in Step 2
  6. Generate another Class with Enerprise WSDL 
  7. Develop a class in ORG2 where you generated apex class to use Login method of Enterprise WSDL using credentials from Org1
  8. Then call the saop method developed in step 1 from the class generated in step 5
You could see this blog: http://www.jitendrazaa.com/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/

Here instead of login using enterprise wsdl he has direclty sending soap request.

All Answers

Shashikant SharmaShashikant Sharma
You should do:
  1. Create a Soap Webservice in one of your org ( ORG1 )
  2. Generate WSDL of this webservice
  3. GEt Enerprise WSDL 
  4. Go to another org ( ORG2 )
  5. Go to Apex Classes an Click button "Generate from WSDL" using WSDL in Step 2
  6. Generate another Class with Enerprise WSDL 
  7. Develop a class in ORG2 where you generated apex class to use Login method of Enterprise WSDL using credentials from Org1
  8. Then call the saop method developed in step 1 from the class generated in step 5
You could see this blog: http://www.jitendrazaa.com/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/

Here instead of login using enterprise wsdl he has direclty sending soap request.
This was selected as the best answer
Abhinav MIshraAbhinav MIshra

On the inbound side, you can create your own SOAP web services by writing Apex methods using the webservicekeyword.  From there you can auto-generate a WSDL (in Develop | Classes).  On the outbound side, you can invoke custom SOAP web services from a Visualforce page controller or Ajax toolkit.  You'll find more in the Integration section of  
 http://http://wiki.developerforce.com/index.php/An_Introduction_to_Apex

Thanks!
Reetesh Makkar
fundooMentalfundooMental

Thank you Shashikant and Reetesh for the valuable reply.

What is salesforce-to-salesforce? Meant for what?. I thought it is meant for the purpose of integrating two salesforce organizations.

Abhinav MIshraAbhinav MIshra
Salesforce to Salesforce is a natively supported feature of the Force.com platform, and easily enables two trading partners to share relevant data records in real time.

Before you can use Salesforce to Salesforce (S2S), you have to enable it. This has to be done by both parties - on your org, as well as on the org with which you are going to share data.

This is the link that can help you understand it more 
https://developer.salesforce.com/page/An_Introduction_to_Salesforce_to_Salesforce