You are viewing limited content. For full access, please sign in.

Question

Question

Importing documents via SDK to Cloud

asked on December 3, 2020

I'm trying to add documents to the Laserfiche Cloud from on premise through a simple program. I'm able to create documents, index metadata, and create folders with their returned ID for these items. The issue I'm experiencing is when I attempt to add pages or an electronic document to the repository to these blank documents that are created. I receive the following error:


Error encountered when receiving an HTTP response

 

I was looking into using the recent cloud api however I would need to append pages to these documents in the case instead of just dumping a whole document with a new name.

0 0

Replies

replied on December 3, 2020

It sounds like you're not connecting with SSL. Can you post your code?

0 0
replied on December 3, 2020 Show version history
String serverName = "", repositoryName = "", userName = "", passWord = "";
            RepositoryRegistration RepoRegistration = new RepositoryRegistration(serverName, repositoryName);
            using (Session LFSession = new Session())
            {
                try
                {
                    CloudTicketRequestSettings ctrSettings = new CloudTicketRequestSettings();
                    ctrSettings.AccountId = "";
                    ctrSettings.UserName = userName;
                    ctrSettings.Password = passWord;
                    CloudTicket CurrentTicket = CloudTicket.GetTicket(ctrSettings);
                    //LFSession.LogIn(userName, passWord, RepoRegistration);
                    LFSession.LogIn(RepoRegistration, CurrentTicket);
                    Debug.WriteLine("Successfully connected to the repository");
                    int documentID = Document.Create(@"\TestFolder\TestDocument", "DEFAULT", EntryNameOption.AutoRename, LFSession);
                    Debug.WriteLine("Created document successfully");
                    DocumentImporter documentImp = new DocumentImporter();
                    
                    documentImp.Document = Document.GetDocumentInfo(documentID, LFSession);
                    try
                    {
                        documentImp.ImportImages(@"C:\Program Files (x86)\Laserfiche\Client\SAMPLE 1.tif",);
                    }
                    catch(Exception e)
                    {
                        Debug.WriteLine(e.Message);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Could not log into the repository");
                }
            }

I omitted any user names/passwords that were being used. I'm doing this out of a VS project.

0 0
replied on December 3, 2020

I changed 

RepositoryRegistration RepoRegistration = new RepositoryRegistration(serverName, repositoryName);

to

RepositoryRegistration RepoRegistration = new RepositoryRegistration(serverName, repositoryName, 80, 443);

however I'm still running into the same issue.

0 0
replied on December 3, 2020
try
                {
                    CloudTicketRequestSettings ctrSettings = new CloudTicketRequestSettings();
                    ctrSettings.AccountId = "";
                    ctrSettings.UserName = userName;
                    ctrSettings.Password = passWord;
                    CloudTicket cloudTicket = CloudTicket.GetTicket(ctrSettings);
                    Session LFSession = Session.Create(serverName, cloudTicket);

                    int documentID = Document.Create(@"\zzConversion\phase00\TestDocument", "DEFAULT", EntryNameOption.AutoRename, LFSession);

                    DocumentImporter documentImp = new DocumentImporter();
                    
                    documentImp.Document = Document.GetDocumentInfo(documentID, LFSession);
                    try
                    {
                        documentImp.ImportImages(@"C:\Program Files (x86)\Laserfiche\Client\SAMPLE 1.tif");
                    }
                    catch(Exception e)
                    {
                        Debug.WriteLine(e.Message);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine("Could not log into the repository");
                }

I rewrote it using the Create method for the session instead of using the Login method with the repository registration. Is there a difference between the two with setting a SSL connection?

0 0
replied on December 3, 2020

You need to set IsSecure to true to use SSL.

LFSession.IsSecure = true; 

 

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.