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
rfanningrfanning 

How to determine Apex web service server prefix

How is the server prefix determined for calls to Apex web services?

Background Information: We are building an app that will be on the AppExchange and will be installed by multiple organizations.  It will have Apex web service methods that will be called from outside of Salesforce when we receive an outbound message.

Specifically, we have an Apex web service:

global class GlobalContactWebService {
  webService static void performOperation(String contactId){
    
    ...
        
  }
}

Depending on which org the Apex web service is installed to, the server prefix in the Web Service URL varies.

I.e.

https://na6.salesforce.com/services/Soap/class/GlobalContactWebService

or

https://na7.salesforce.com/services/Soap/class/GlobalContactWebService

How do we know which Apex web service server prefix should be used for a given org?

I have looked at the following resources without mention of which server prefix should be used in calls to Apex web services:
http://www.salesforce.com/us/developer/docs/api/index.htm
http://wiki.developerforce.com/index.php/Apex_Web_Services_and_Callouts
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_web_services.htm

Thanks!
Best Answer chosen by Admin (Salesforce Developers) 
SuperfellSuperfell
The Outbound message includes enterprise & partner server URLs, you can take the host name from one of those and use it with the apex web service.

All Answers

SuperfellSuperfell
The Outbound message includes enterprise & partner server URLs, you can take the host name from one of those and use it with the apex web service.
This was selected as the best answer
rfanningrfanning
Thanks