1

I can login to our main salesforce (salesforce.com) system with the Soap api w/o any issues. We have a Sandbox site (test.salesforce.com) and I have working credentials for this site as well. In need to test my code against the test ste before deploying to the main site.

The Soap login always fails with an invalid login when I use the test site credentials.

I am assuming that soap login is hitting salesforce.com instead of test.salesforce.com.. I so not see an obvious way to change this behavior.

There is the LoginScopeHeader ... It has an organizationId (which I have) and a portalId (which I have not located). I have tried this with the organizationId to no avail.

login(nothing, mainsiteusername, mainsitepassword) = This works!
login(nothing, textsiteusername, testsitepassword) = fails
login(scopeheader, textsiteusername, testsitepassword) = fails
*note scopeheader only populated with organizationId.

Any suggestions?

1

I am assuming that soap login is hitting salesforce.com instead of test.salesforce.com.. I so not see an obvious way to change this behavior.

This is almost certainly the reason, particularly if it connects using your production org. I'm unsure of what language you're using, but with PHP we download the 'soapclient' which comes with two XML files, enterprise.wsdl.xml andpartner.wsdl.xml.

In order to connect this with your org and provide access to any custom fields, you need to update the WSDL file (Enterprise or Partner, depending on what you're using) that describes your org. To get this, go to: Setup > Develop > API and you should see the option to

Generate Enterprise WSDL

and

Generate Partner WSDL

Replacing the XML files in your soapclient folder with the files you generate directly from your Sandbox org should successfully connect you.

Other things to consider:

  • Make sure you're appending your sandbox name to your username (unless you changed it) (e.g. yourname@yourcompany.com.yoursandbox)
  • Sandbox specific security key, you'll want to generate this and append it to your password from your sandbox
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.