The core issue is understanding how Agile’s web service token lifetime and token refresh logic work, especially for large file upload handling in batch scenarios. Let me provide the complete solution.
Web Service Token Lifetime Architecture:
Agile web services use JWT-based tokens with two distinct timeout values:
- Absolute Lifetime (token.lifetime): Maximum token validity from creation (3600s default)
- Idle Timeout (token.idle.timeout): Maximum time between API calls (2700s default)
- Active Session Timeout: Separate from token timeouts, tracks actual authentication session
Your tokens expire at 45 minutes (2700s idle timeout) because file upload streams don’t count as API activity for token validation purposes.
Token Refresh Logic Implementation:
The solution requires proactive token management in your batch upload process:
// Pseudocode - Token refresh during batch upload:
1. Authenticate and store token with timestamp
2. Before each file upload, check: (currentTime - tokenTime) > 2400s
3. If near expiration, call /auth/refresh endpoint
4. Update stored token and timestamp
5. Proceed with file upload using fresh token
6. Repeat check for each file in batch
Key implementation details:
- Refresh at 2400s (40 min) to stay under 2700s idle timeout
- Store token creation timestamp, not just the token string
- Handle refresh failures gracefully (re-authenticate if refresh fails)
- Log all token operations for troubleshooting
Large File Upload Handling - Optimal Strategy:
For 500MB+ simulation files, implement a three-tier approach:
Tier 1 - Chunked Upload with Heartbeat:
Chunk size: 100MB (as you're doing)
Heartbeat: Send keep-alive API call every 20 minutes during chunk upload
Endpoint: /api/session/keepalive (lightweight, resets idle timer)
This keeps the token active even during long chunk transfers.
Tier 2 - Pre-Upload Token Refresh:
Before starting each file:
1. Calculate estimated upload time: fileSize / averageUploadSpeed
2. If (estimatedTime + currentTokenAge) > 2400s, refresh token
3. Start upload with fresh token
4. Track actual upload time for better estimates
Tier 3 - Chunk-Level Token Validation:
For each 100MB chunk:
1. Check token age before chunk upload
2. If > 2000s (33 min), refresh token
3. Upload chunk with current valid token
4. Continue to next chunk
Configuration Changes:
Adjust timeout values for simulation data workloads:
-
Increase idle timeout (if permitted by security policy):
webservice.token.idle.timeout=5400
(90 minutes instead of 45)
-
Enable automatic token extension for file operations:
webservice.file.upload.extend.token=true
webservice.file.upload.reset.idle=true
-
Configure chunked upload timeout separately:
webservice.chunk.upload.timeout=7200
(2 hours for very large files)
These settings go in agile.properties and require app server restart.
Batch Processing Best Practices:
For your 8-10 file batch scenario:
- Authenticate once per batch (not per file)
- Implement token refresh every 30 minutes regardless of upload progress
- Track cumulative batch time and force re-authentication if approaching absolute lifetime
- Use parallel uploads with shared token if network bandwidth allows (max 3 concurrent)
- Implement exponential backoff for 401 errors (don’t immediately fail the batch)
Error Recovery Strategy:
On 401 Token Expired:
1. Attempt token refresh (may succeed if within absolute lifetime)
2. If refresh fails, re-authenticate with credentials
3. Resume upload from last completed chunk
4. Log token expiration for monitoring
5. Don't restart entire file upload - resume from failure point
Monitoring and Diagnostics:
Add these logging points to your integration:
- Token creation timestamp
- Token refresh events with remaining lifetime
- Upload start/end times per file
- Chunk upload duration
- Token expiration events (even if recovered)
This data helps optimize refresh timing and identify network issues vs. token issues.
Alternative Approach - Multipart Upload API:
Agile 9.3.4 includes a multipart upload endpoint specifically for large files:
Endpoint: /api/v2/files/multipart
Features:
- Automatic token refresh during upload
- Built-in chunk management
- Resume capability for failed uploads
- Progress tracking
This API handles token lifecycle internally, eliminating the need for manual refresh logic. Consider migrating to this endpoint for simulation data uploads.
Testing the Solution:
- Implement token refresh at 40-minute intervals
- Test with a batch of 10 files, each 500MB
- Monitor token refresh events in logs
- Verify no 401 errors during 3-hour batch run
- Confirm all files upload successfully
With proper token refresh logic, your simulation data uploads should complete reliably regardless of batch size or cumulative upload time.
This draft is based on general Oracle Agile PLM knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.