Skip to main content
added 749 characters in body
Source Link
Daniel Ballinger
  • 103k
  • 40
  • 275
  • 601

You will need to set the endpoint for the client based on the LoginResult serverUrl.

The login call will go to login.salesforce.com. When it comes back the serverUrl will be something like https://na5-api.salesforce.com/services/Soap/u/34.0https://na5.salesforce.com/services/Soap/u/34.0.

partnerSoapSforceCom.Soap partner = new partnerSoapSforceCom.Soap();
partnerSoapSforceCom.LoginResult lr = partner.login('[email protected]', 'SomePassword' + 'SomeSecurityToken');    

ARTaskWebService.AR_getActivitiesWebservice client = new ARTaskWebService.AR_getActivitiesWebservice();
client.SessionHeader = new ARTaskWebService.SessionHeader_element();
client.SessionHeader.sessionId = lr.sessionId;

// You may need to adjust this if using a custom Apex Soap service.
client.endpoint__x = loginResultInstancelr.serverUrl;

Since your Apex class Soap class probably has an endpoint like https://na8.salesforce.com/services/Soap/class/AR_getActivitiesWebservice you may need to adjust this using the domain in the LoginResult serverUrl.

E.g. replace the na8 pod identifier in your current endpoint with na5 if that is what the serverUrl comes back with.

You will need to set the endpoint for the client based on the LoginResult serverUrl.

The login call will go to login.salesforce.com. When it comes back the serverUrl will be something like https://na5-api.salesforce.com/services/Soap/u/34.0.

// You may need to adjust this if using a custom Apex Soap service.
client.endpoint__x = loginResultInstance.serverUrl;

You will need to set the endpoint for the client based on the LoginResult serverUrl.

The login call will go to login.salesforce.com. When it comes back the serverUrl will be something like https://na5.salesforce.com/services/Soap/u/34.0.

partnerSoapSforceCom.Soap partner = new partnerSoapSforceCom.Soap();
partnerSoapSforceCom.LoginResult lr = partner.login('[email protected]', 'SomePassword' + 'SomeSecurityToken');    

ARTaskWebService.AR_getActivitiesWebservice client = new ARTaskWebService.AR_getActivitiesWebservice();
client.SessionHeader = new ARTaskWebService.SessionHeader_element();
client.SessionHeader.sessionId = lr.sessionId;

// You may need to adjust this if using a custom Apex Soap service.
client.endpoint__x = lr.serverUrl;

Since your Apex class Soap class probably has an endpoint like https://na8.salesforce.com/services/Soap/class/AR_getActivitiesWebservice you may need to adjust this using the domain in the LoginResult serverUrl.

E.g. replace the na8 pod identifier in your current endpoint with na5 if that is what the serverUrl comes back with.

Source Link
Daniel Ballinger
  • 103k
  • 40
  • 275
  • 601

You will need to set the endpoint for the client based on the LoginResult serverUrl.

The login call will go to login.salesforce.com. When it comes back the serverUrl will be something like https://na5-api.salesforce.com/services/Soap/u/34.0.

// You may need to adjust this if using a custom Apex Soap service.
client.endpoint__x = loginResultInstance.serverUrl;