You need to sign in to do that
Don't have an account?
How the Session Id Works in the Web Service API
We set up an application which did a salesforce login followed by an upsert and a logout. What we learned was that if we had multiple threads using this application, once the first thread reached the logout step, the other threads' session ids became invalid. We got around the problem by dropping the logout step. My question is this:
1. If two threads login with the same credentials, do they get the same sessionId?
2. If so, is it then just best practice not to logout and instead let the session timeout? Each thread would still log in.
3. Or would it be better practice to store the session Id after one login and have other threads try to access the salesforce web service using that sessionId? Only if the access fails would the thread log in.
Thx.
- Cris
HI,
I wanna know the same thing.
Do you get reply about your questions?
Thanks,
Don't call logout, also call login once from one thread and share the resulting sessionId value, there's no need to call login from each thread.
Yes...I learned that the hard way. Especially the second part of that advice. While it is true that consecutive logins without logouts return the same session id, you could face a problem if that's all you do. Too many logins in too short a period and SF will start rejecting them. I had this experience with high load. Now, I salt away the session id in a database and try it first. I only login if the session id is rejected owing to having expired.
- Cris