I have a webservice that logs to Salesforce, and keeps track in memory of the session expiration by getting the value of loginResult.userInfo.sessionSecondsValid from the SFDC LoginResult part of the WSDL Enterprise API, adding the seconds to a static DateTime object for future evaluations at runtime.

In the development and testing stages (from lots of different workstations and webservers) I had no problems, but after installing it to production I realized that it was login in on each WebMethod call.

I thought the static variable was losing its value, and posted a question in SO about it.

By debugging the condition that determined if there was a need for retrying the login in the production box, i realized that loginResult.userInfo.sessionSecondsValid returned as zero, and checking in my local workstation and other development servers the value correctly returned as 7200 (2 hours for session expiration in our org).

What could cause the difference in the expiration times? some security setting perhaps?

Thanks in advance.

  • possibly your prod box is using an older api version where that field wasn't included.
    – superfell
    Mar 24, 2016 at 15:15
  • You are absolutely and completely right, can you post it as an answer so I can approve it?
    – FuuRe
    Mar 24, 2016 at 15:50

1 Answer 1


It sounds like your prod box is using an older API version where the sessionSecondsValid property didn't exist (and so you'd see the default of 0 in your code).

  • This was it, so simple that it made me feel bad for not catching it earlier
    – FuuRe
    Mar 27, 2016 at 5:41

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.