I am trying access the Salesforce API from an external application. I've done the following:
- I've gone to the API tab and generated the WSDL.
- I then ran the .NET framework's WSDL tool to generate the C# file, which I then added to my C# project.
-
I then attempted to login in the following manner:
SforceService binding = new SforceService();
LoginResult result = sfs.login(uid, pwd);
I get an error on the .login
method: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
Then I realized that we have single signon enabled on our environment, so that maybe the .login method is unnecesary. So I proceeded without it.
SforceService binding = new SforceService();
var qResult = binding.query("SELECT Name FROM Account");
I got an error on the .query
method: UNKNOWN_EXCEPTION: Destination URL not reset. The URL returned from login must be set in the SforceService
.
So I am lost at this point. Is there something simple I am missing?
Best Answer
I had the wrong username, but there was actually more to it. I had to reset session ID and server URL.
Here is the way to do it, so that others can benefit.