function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikki.ax79Nikki.ax79 

Invalid session ID

I am using the 4.0 SOAP API, with java 1.4.2_03

I have a Salesforce account that has approximately 60,000 records in it. I am using queryMore to pull the records 800 at a time. (I cannot increase this batch size due to the 10,000 character limit on queries.) When I get a batch of records back I do some processing and then ask for the next batch. This all goes swimmingly until my session times out after two hours. I get an invalid session exception and can't continue. I only get through about 30k records in this time frame. I can't start over, because I won't have any notion of where I've left off. Does anybody have a clever work-around for this?

TIA,
Nikki
SuperfellSuperfell
You should be to call Login between calls to queryMore, either keep track of how old your session is and re-login as needed, or catch that specific exception and re-login and carry on.
Nikki.ax79Nikki.ax79
thanks, I think that will work
darozdaroz


I have a Salesforce account that has approximately 60,000 records in it. I am using queryMore to pull the records 800 at a time. (I cannot increase this batch size due to the 10,000 character limit on queries.) When I get a batch of records back I do some processing and then ask for the next batch. This all goes swimmingly until my session times out after two hours. I get an invalid session exception and can't continue. I only get through about 30k records in this time frame. I can't start over, because I won't have any notion of where I've left off. Does anybody have a clever work-around for this?


Another options that I have to use is when I'm dealing with a large result set is to create an array to hold all the objects and then iterate through the local copy of them. My problem is that for long queries I run out of query locators and get an exception because the locator has expired.

You'll also find that more likely to happen when you have to query() a large result set and issue several other query() calls for each object you have returned in the first (large) query.