+ Start a Discussion
Brian.ax17Brian.ax17 

Invalid Session ID found in SessionHeader

I'm trying to add Cases from VB.Net using the 2.5 api. The program runs fine for small inserts and updates, but during the initial load (some 11,800 cases) an exception occured after 2,000 to 3,500 cases had been process:

INVALID_SESSION_ID: Invalid Session ID found in SessionHeader

I eventually loaded all the records by removing those successfully processed from the local input table, and the routine looks to work happily on the daily incremental changes in the local source system.

However, I am likely to need to do more large data loads, so need to understand what is going wrong. Any thoughts why the Session ID should become invalid while processing large numbers of records?

Thanks,
Brian

DevAngelDevAngel

Hi Brian,

I'm guessing that the initial load is taking at least 2 hours.  A session id will go stale after 2 hours from issuance.  You will need to catch the error you mentioned and re-login to obtain a new session id.

Brian.ax17Brian.ax17

I checked the SQL Job History. Spot on! The jobs executed for 2Hrs 11secs, 2hrs14 and 2hrs 15. All my other jobs are 10s of minutes at most.

Back to the coding pad

Thanks

SimplySfdcSimplySfdc

Is there anyway to make session ID > 2 hours ?

sq

SuperfellSuperfell
If the request is made against a recent API version (5.0 and above i think), then the session length is based on the settings in setup. For earlier api versions its a fixed 2 hours.