How to overcome the timeout limitation of UploadFile() in the WebdavApiClient for TSSS API

How to overcome the timeout limitation of UploadFile() in the WebdavApiClient for TSSS API

book

Article ID: KB0077173

calendar_today

Updated On:

Products Versions
Spotfire Statistics Services All Versions

Description

The default timeout value for the WebDav.UploadFile() in WebdavApiClient for TIBCO Spotfire Statistics Services (TSSS) API is about 1000000 ms, or around 17 minutes and this default value cannot be changed. Hence when uploading large files to TSSS server this timeout value may be reached and an timeout error may be raised.
 

Issue/Introduction

This article explains about the timeout value of UploadFile() and how to overcome its limitations

Resolution

As a workaround you can use the WebDav libraries that are included with the C# API to write your own upload function that could extend this timeout. Here's how:
1. Add a reference to Independentsoft.Webdav.dll (included with the C# API - <TSSS Installation PAth>\TERR\ext\CSharpAPI) to your C# project.
2. Add an import to the top of your C# source code as:
using Independentsoft.Webdav;
3. Add the following static function (may need some modification as per your requirement) to C# source code and use it to perform the uploadFile operation:
public static void UploadFile(string url, string filePath, string userName="", string password="")
{
    NetworkCredential credential = new NetworkCredential(userName, password, String.Empty);
    WebdavSession session = new WebdavSession(credential);
    Resource res = new Resource(session);
    res.Timeout = 2000000;
    res.Upload(url, filePath);
}

 

Additional Information

Sample: Upload File