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
Prashant Malewar 9Prashant Malewar 9 

Need to login into Salesforce Sandbox via Apex Soap Api

Hello Everyone,
I am new to salesforce,
I wants to loging into another Salesforce Sandbox  Account using SOAP api .
soapO1 =new partnerSoapSforceCom.soap();
loginO1 = soapO1.login(sfun_u,sfpwd_u);
but login() is not working for sandbox credentials, It is working fine for normal developer credentials.

Thanks 
Alexander TsitsuraAlexander Tsitsura
Hi Prashant Malewar,

This is because you trying login to 'login.salesforce.com' endpoint. If you want to connect to the sandbox, an endpoint should be 'test.salesforce.com'.
Find in your class "partnerSoapSforceCom" property with name "endpoint_x" and replace "login" on "test".

For example:
// Developer, Production
public String endpoint_x = 'https://login.salesforce.com/services/Soap/u/30.0';

// Sandbox
public String endpoint_x = 'https://test.salesforce.com/services/Soap/u/30.0';

Thanks,
Alex