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

Question

Question

.Net Core and HttpClient

asked on June 18, 2019 Show version history

Hi, 

 

I'm trying to create a wrapper around a class library so from .Net Core 2.2 we can use web services. I've created a project which uses .Net 4.7 based on the samples, when calling from a Console Application it works, when I add a .Net Core 2.2 API Project and call that class it says the Can't load Laserfiche HttpClient? 

are there any examples with .Net Core? also I've read a few posts regarding Http Client and it's not been answered, I'm using the 10.2 version.

 

Thanks in advance.

0 0

Replies

replied on June 18, 2019

The Laserfiche SDK is currently not compatible with .Net Core.

0 0
replied on June 18, 2019

Hi Brian,

Thanks for the response, I'm aware that it's not compatible (from the forum posts), however even wrapping the class with .Net 4.7 causes an issue with HttpClient not loaded even though I've installed VC++ runtime for x64 and x86. Is there anything I can try to resolve the HttpClient error. I can't seem to find the HttpClient 10.2 dll, the SDK hasn't got any examples of using the HttpClient, unless this is a low level dll.

 

Thanks again

Rav

 

0 0
replied on June 18, 2019

It is a low-level assembly used by RA, there's no need for you to use it directly.  I'm not an expert on .Net Core, but I don't understand how wrapping a class will help - eventually all dependencies have to be loaded, and they are not all compatible.

0 0
replied on June 19, 2019

.net core can communicate to the .net 4.7 framework, the class works in isolation with unit tests, but adding the .Net Core web API project then tries to load the HttpClient (the dependency) which is can't. 

 

I'll try with a .net 4.7 web api project and see how that goes, shame .Net Core isn't supported though.

 

Thanks

 

0 0
replied on June 18, 2019

Hi Rav,

If you're looking for a web services interface for Laserfiche repositories, have you checked out the CMIS Gateway component of the SDK? It provides a REST API via its Browser binding.

0 0
replied on June 19, 2019

Hi Samuel,

 

Thanks I'll take a look and update this post.

 

 

 

0 0
replied on July 2, 2019

Hi Samuel,

Does CMIS Gateway also available with SDK 10.2

My client wants to go to .NET core and i was looking whether CMIS gateway is the better option to use with .NET core for document storage and retrieval. 

If yes, can you direct me to find on its usage , some samples will be helpful.

 

Thanks,

Sonali Patil

 

0 0
replied on July 2, 2019

Hi Sonali,

Yes, the Laserfiche CMIS Gateway is included with SDK 10.2. It implements the CMIS 1.1 Browser and Atom bindings.

CMIS Gateway may be a good option to use with .NET Core. Definitely better than building your own API on top of the Laserfiche .NET Framework libraries.

The PortCMIS client library targets .NET Standard 1.1, which includes .NET Core.

Please see: https://chemistry.apache.org/dotnet/portcmis.html

0 0
replied on July 3, 2019

Thanks Samuel. Sounds wonderful.

To plan these updates to our current environment.

Few queries - Does it need to have any updates done at Laserfiche repository/Web client to allow CMIS gateway?  includes any installation?

0 0
replied on July 3, 2019

Hi Sonali,

Glad I could help. CMIS Gateway is an IIS web application that you install from the SDK package.

The Laserfiche web and Windows clients do not use CMIS Gateway. They natively connect directly to Laserfiche Server repositories using the .NET Framework RepositoryAccess and COM LFSO (Laserfiche Server Objects) libraries respectively. 

CMIS Gateway provides a generic content management web API for integration purposes. The PortCMIS client library I linked in my previous response supports .NET Core. A .NET Core app/integration that uses the PortCMIS libraries can communicate with the Laserfiche CMIS Gateway.

0 0
replied on July 4, 2019

Thanks Samuel, Seems we may not have selected  option for CMIS while initial  installation. So can we run setup again and get the feature added? Hope its that simple :)

0 0
replied on July 5, 2019

Yep! Simply relaunch the SDK installer's "autorun". You should see the screen I posted above where you can select "Laserfiche CMIS Gateway". Make sure to read the documentation on configuring it to connect to a repository as there is no GUI - you have to update the config.json file by hand.

Here's an example config with two repository connections. Anything in <brackets> is a placeholder.

{
  "repositories": [
    {
      "server": “<LFS FQDN>",
      "port": 80,
      "name": "<RepoName1>",
      "ssl": false,
      "id": "<id1>",
      "description": "<Prod HR Repo>",
      "authentication": [ "basic", "token", "windows"],
      "rootFolderId": 1,
      "thinClientUrl": "<https://webclientserver.company.com/laserfiche/>"
    },
    {
      "server": “<LFS FQDN>",
      "port": 443,
      "name": "<RepoName2>",
      "ssl": true,
      "id": "<id2>",
      "description": "<Prod Accounting Repo>",
      "authentication": [ "basic", "token","windows"],
      "rootFolderId": 1,
      "thinClientUrl": "<https://webclientserver.company.com/laserfiche/>"
    }
  ]
}

 

0 0
replied on July 8, 2019

Hi Samuel,

 

config json is configured. but i could not get luck with rest services 

 

Can you confirm REST API Url - /LFCMIS/browser/id1/root?cmisaction=

 

also  where i can find list of cmisactions for different repository access, struggling to get sample codes

1 0
replied on July 8, 2019 Show version history

The root browser REST API URL is: https://server.company.com/LFCMIS/browser

The repo path is: https://server.company.com/LFCMIS/browser/id1/

To fetch a electronic file-type document with Entry ID 9, I'd use:

https://server.company.com/LFCMIS/browser/id1/root?objectId=9&cmisselector=content

Here's a link to a post with a resource that many help you:

https://answers.laserfiche.com/questions/161104/CMIS-schema-folder-missing-from-installation-folder#161224

As CMIS is an open specification that Laserfiche only recently implemented, your best bet for sample code will be searching the internet.

A few things to be aware of:

  • Laserfiche fields are secondary table in CMIS, so you should add the secondary table prefix when querying (lf:fields.field in this case).
    As a general example:
    SELECT lf:fields.field:PoNumber FROM cmis:document WHERE lf:templateName = 'Invoice' AND lf:fields.field:PoNumber = '000576'
  • Edocs and Laserfiche images are actually mapped to different concepts in CMIS. The electronic file is mapped to the Content, while individual pages are mapped to Renditions. If you are storing documents as image pages, you should check if entry has pages in Renditions, get a list of the pages, and then retrieve the individual pages.
  • Never use a SELECT * FROM ... query in a prod app. Always provide the specific list of properties/attributes you want back. Returning ALL properties is incredibly expensive and can slow search performance by an order of magnitude or more.

 

You may find it helpful to download the Apache CMIS Workbench tool and enable full logging. It'll show you the exact HTTP calls it's making for various actions. Be aware there are some quirks with the CMIS Workbench that are not necessarily Laserfiche CMIS errors.

1 0
replied on July 16, 2019

Thank Samuel, that's helpful.

I am facing a minor issue with syntax with fields having space in name.

 

/LFCMIS/browser/id1/?q=SELECT [lf:fields.field:Business Unit from cmis:document WHERE cmis:objectId='30283'&cmisselector=query

 

had tried couple of options like [lf:fields.field:Business Unit] and following too - but no luck. this could be missing proper syntax. 

 

/LFCMIS/browser/id1/?q=SELECT lf:fields.field:Business%20Unit from cmis:document WHERE cmis:objectId='30283'&cmisselector=query

 

0 0
replied on July 16, 2019 Show version history

We've also tried:

lf:fields.field:'Business Unit'

lf:fields.field:[Business Unit]

lf:fields.field:Business\ Unit


and have also tried URL encoding those symbols. I've not the RFC but no example online, across a number of other implementations include a space in the attribute names.

I've tried running SQL profiler, because the error message says something like "sql error at line 1, position 85" but it seems the error is generated by the GMIS gateway, not the SQL server.

replied on January 14, 2020
  1. http://~ browser/id1/?q=SELECT%20*%20from%20cmis:document%20WHERE%20cmis:objectId=%2731588%27&cmisselector=query

 

Result set:

 

 

  1. Direction Field  query: http:/~ /LFCMIS/browser/id1/?q=SELECT%20lf:fields.field:Direction%20from%20cmis:document%20WHERE%20cmis:objectId=%2731588%27&cmisselector=query

Result set:

  1. Document Type query: http:/~ /LFCMIS/browser/id1/?q=SELECT%20lf:fields.field:Document%20Type%20from%20cmis:document%20WHERE%20cmis:objectId=%2731588%27&cmisselector=query

Result Set :

 

Query 2 and 3 are queries that are against the same document and object  but if you see the result set , it is getting populated for the fields which don’t have the space(Direction field) and for  field(Document Type) nothing is getting populted . This behaviour has been tested and confirmed for all the fields which are having space . Query 1 has the result set which has all the fields listed .

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

Sign in to reply to this post.