You need to sign in to do that
Don't have an account?

Java Partner WSDL - INVALID_SESSION_ID - Invalid Session ID found in SessionHeader: Illegal Session.
I have a Java application that's connecting to Salesforce using PartnerConnection.
Queries work fine at first but overnight it seems like the session expires/becomes invalid. What's the best way to check if the session is valid without performing a query?
Queries work fine at first but overnight it seems like the session expires/becomes invalid. What's the best way to check if the session is valid without performing a query?
connection.getServerTimestamp();doesn't seem to work. Once I catch the error, would creating a new PartnerConnection work?:
catch (UnexpectedErrorFault uef) { if (uef.getExceptionCode() == ExceptionCode.INVALID_SESSION_ID) { this.connection = new PartnerConnection(this.getConfig());Thanks.
Yeah, you'll need to renew your sessions at some point. The best way to handle it is likely to catch the invalid session id and then re-login / grab a new session at that point. Alternatively, you could keep calling login, which will use the same session if one is available, but you would eat up additional api calls with that approach.