Tuesday, November 5, 2013

Pros And Cons of Different Ways to Custom Programming for eDOCS DM

Below I describe 5 different approaches that I know to programming for OpenText eDOCS DM:
DM Extensions API, DM API, Extending DM Webtop, Consuming WCF Service, and Direct Access.


DM Extensions API 

It's described in detail in eDOCS DM 5.3.1 DM Extensions API Programmers Guide.pdf from eDOCS DM documentation. You may want to use it if you integrate your code into DM Extensions menus or if you utilize many UI elements of DM Extensions, such as profile, search, and lookup forms. This is the advantage of this approach.

Using this approach, you activate an instance of the DM.exe process via COM, the DOCSObjects.Application object. This dependency on DM.exe seems to me as the biggest disadvantage of this solution, if you are considering it for a standalone application and not for extending DM Extensions.

I saw a few tools created with DOCSObjects.Application and the most common problem guys had was that they couldn't properly reuse the running instance of DM.exe and then they couldn't properly detach from it after their tool is closed. DM.exe was left running in the background, and until it is killed from Task Manager, even Windows Explorer DM Extensions couldn't be launched. At the same time the guys hardly used many UI elements of DM Extensions. All they needed from it were the Login dialog and the document download popup progress. The former could be easily built from the scratch; the latter is extremely slow, if you want to upload or download multiple documents. So, what's the point?

Pros:
  • You can reuse UI elements of DM Extensions.

Cons:
  • In terms of UI, you get what you get, without much control over how it looks and when it pops up. 
  • You have to take care of activating / deactivating DOCSObjects.Application properly.

DM API

eDOCS DM 5.3.1 DM API Reference Guide.pdf is about it. Some developers refer to it as DM Server API vs. DM Extensions (Client) API described above, but this is incorrect. It's the client-side API:
Objects are created and executed on the client side; DCOM calls to the DM Server are hidden from the developer.

DM API is a set of COM (ActiveX) DLLs, which are installed in C:\Program Files (x86)\Open Text\DM API by default. DM Extensions is built on top of DM API. That's why you can use it on any computer where DM Extensions are installed. And the opposite is true: if DM Extensions are not installed, you must distribute DM API along with your application. Deployment considerations are on the downside of using DM API.

You can write code with DM API in many different programming languages, which allow the use of ActiveX: C++, VB6, VBA, C#, VB.NET, etc. However, is this a big advantage? With the choice given, I don't even consider anything but .NET. The problem is that DM API is VB6-like and using it in .NET is awkward, unless you write some managed wrappers.

Pros:
  • This is documented API. You can find code samples, so it's easy to start with.
  • It has no UI. You are free to implement User eXperience as you want.
  • It's best to be used in custom applications for client computers where DM Extensions are installed. The DM Server installation also includes DM API, so you can also create custom server tools with DM API and enjoy the ease of deployment.
Cons:
  • Deployment complexities. Being ActiveX-based, DM API DLLs are relatively difficult to deploy along with your application, unless you deploy it to a DM Server or a workstation with DM Extensions. There is a standalone MSI installation of DM API if you may need it.

Extending DM Webtop (CyberDOCS)

Check eDOCS DM 5.3.1 Webtop Customization Guide.pdf. This is somewhat similar to extending DM Extensions, but for Web. I don't know much about it, but it's unlikely I would want to use it. It's old classic ASP. Does anyone find fun developing and debugging it nowadays?

Pros:
  • The only way to seamlessly embed your custom UI code into DM Webtop.
Cons:
  • Old classic ASP. You've got to find some antique developer tools to build for it.
  • Depending on how good you are in isolating your customizations, you will have more or less pain in updating your code with new releases of eDOCS DM.

Consuming DM WCF Service 

DM WCF Service is a new feature in DM 5.3. With it you can do everything of what you can do using DM API. At the same time, you are totally independent of DM API dlls, at design time and also at runtime. You can build your application in any language, which allows you to consume Web services. eDOCS DM publishes WSDL-description of its service and this is pretty much all you need to know to build a client. Using Visual Studio: you simply add a Web Reference to your project and you are ready to use the auto-generated classes. Doesn't it sound great?

But it wouldn't be Hummingbird / OpenText, if it were great by all means ;) On the other side of the coin we see:
a) Documentation is nowhere found on eDOCS DM CD.
b) API - classes, methods, and parameters - don't look .NET-like. They are more Pascal-like.
b) It's really low-low-level. When I said that DM API is low-level, then compared to it the DM WCF service is way under the ground. For example, after executing a search criterion, you are to get results from the server in binary chunks and to parse them.

Fortunately, there is an eDOCS_Samples demo project accompanied by eDOCS Samples Application.docx. I hope you can find it in OpenText Knowledge Center. I inherited my copy from a guy who worked before me.

Although DM WCF Service is .NET, it translates calls back to native DCOM objects on the server side. This means that you will not get any performance boost over DCOM and DM API.

In DM 5.3.1 Patch 4, DM WCF Service exposes two server endpoints: basic HTTP and net.tcp. I haven't had time yet to check if there are more and if there is a way to configure their behaviors.

With this said, I like DM WCF more than DM API. You would have to build helpers / wrappers for either of them, so it's probably wiser to do this right away for WCF rather than for both as I did.

Pros:
  • It's .NET. It's managed code.
  • Easy to deploy. No dependencies on any DM redistributable components, such as DM API DLLs.
  • Easy to consume (WSDL to generate a WebService reference).
Cons:
  • Undocumented. OpenText may decide to change the interface or take it out completely in the future.
  • Low-level. You have to build a set of helpers / wrappers for your own convenience.

Direct Access to Database and Document Servers

I love it, when it comes to extracting metadata and documents from DM! It's way, way faster than going through the DM application server as it's free of any business logic involved and COM+ technology burden. All you need to have is the access to the database and document servers, which you usually have, if you administer the document management system.

Apparently, this approach is for read-only operations only, where DM's business logic is primitive enough to be replicated in your application. Thus, for data extracts I would need to be able to recognize document versions (e.g. find the latest) and compose the file name - not big deal at all.

For the database access I use fabulous DevExpress XPO. And as for copying files, it's as simple as calling System.IO.FIle.Copy.

Pros:
  • The fastest possible data access.
  • True multi-threading is at your own hands.

Cons:
  • For administrators only.
  • For read operations only.
  • Even for read-only operations, replicating DM logic may be a challenge.

13 comments:

  1. Hi Nick, thank you for all the information you are sharing with us. I really do appreciate it. I searched your blog, but could not find any examples or code related to "Direct Access to Database and Document Servers". Have you written any? I would appreciate you sharing such information. Thank you. Rocco le Roux

    ReplyDelete
    Replies
    1. Hi Rocco,

      Thanks for your comment. I don't think I have code samples ready for sharing, but I'll explain the concept and, you can see it, it's very simple to implement. The approach can be used by a eDOCS DM administrator with the assumption she has a) a login to the DM's database -- needed for reading data directly from the database; b) has the credentials of the account that runs OpenText DM Service -- needed to read files directly from document servers; c) data access policies at the enterprise, if any, are not an issue for the task. Then you can create a program that, for example, finds a document in the PROFILE table, composes the full path to the physical document (the file name is in the COMPONENTS table) and reads or copies it. Since the document is located on a document server with restricted access, your program should be launched on behalf of a user who has access to it, e.g. with the DM service credentials. Shift+Right click on an executable or shortcut opens a context menu with the "Run as different user" option in Windows that can be very helpful in this case. I hope this makes sense.

      Delete
  2. Great! :-) thank you, that helps a lot. I think I have a problem with my data...... I got a DB backup from the client and my goal is to write an importer app to SharePoint 2013. my only hurdle is understanding the HummingBird 5.3.1 DB schema. I went through the tables but could not find a single PATH field that contains usable data. The data in my COMPONENTS table reads as follows:

    PATH LOCKED COMPTYPE VERSION_ID DOCNUMBER FILE_SIZE ALTERNATE_PATH
    1601!.PPT * NULL 42 42 NULL NULL

    The only relation I could find was that there is a record in the DOCUMENTS table with a BUNDLEID of 1601, but still no actual path.
    Am I missing something?

    ReplyDelete
    Replies
    1. Rocco,

      COMPONENTS.PATH is just the file name. The full path is PROFILE.DOCSERVER_LOC + PROFILE.PATH + COMPONENTS.PATH. Join the tables by the DOCNUMBER column. And if you care about document versions, the VERSIONS table must be also involved by joining it with COMPONENTS by VERSION_ID.

      Delete
    2. Nick you are a true life saver. Thank you for your assistance. I am in the process of completing some SQL scripts to export & scrubbing the document related data to XML. I would gladly post them on your blog if you like. - Regards, Rocco le Roux

      Delete
  3. Hi Nick, thanks for posting this!

    Dude I don't find the DM WCF Service documentation anywhere, can you upload what you have in some place?

    Regards

    ReplyDelete
    Replies
    1. Hi Rafael,

      If you have access to OpenText Knowledge Center, check this link:
      https://knowledge.opentext.com/knowledge/cs.dll?func=ll&objaction=overview&objid=32545201

      or search for "eDOCS Web Services Samples Applicaton".


      You may also want to review the code of my DRF Link Handler tool that utilizes DM WCF:
      http://softinclinations.blogspot.ca/2015/03/drf-and-pcdocs-link-handler-for-edocs-dm.html

      I hope this helps.

      Delete
    2. Hi Nick,

      Thank you for the reply! I will study your code.

      I was trying to convert you EDocs WCF code to show the security fails, but whenever I change the Recent Docs Call to a Search call using the same approach you did, I got a ugly error from the server.
      The lack of open documents for this Webservice is such a pain!

      I don't have access to the knowledge center.

      BTW, I know you out of EDocs subjects, but you could put every code you made from this blog in a GitHub account, this should help other like me to find more stuff about EDocs API and make the code live alone, with the community forks and so on.

      Regards.

      Delete
    3. Hi Rafael,

      OpenText was tightening security of their DM WCF interface and I really don't know where they ended up with it. Back in time when they released the Auto Logon hotfix it worked weird: it said OK to a logon request, but when you try to make some real request thereafter, such as search, it would reject it as if you have a wrong login token. If this is still the case and you want your application working, your best bet is to mimic the behavior of DM Extensions. It sounds simple but in reality it means switching DM Extensions to WCF channel, trying different actions in it, and watching requests/responses by debugging the DM WCF Service and learning from what you see.

      And that's not a bad idea at all for placing my code in GitHub and let it live and evolve on its own. Thank you for it! I have no problem with it and will put it on my to-do list and see what I can do.

      Thanks!

      Delete
  4. Hi Nick,
    I cannot find any documentation of DM WCF. Where can I find it?
    I've just try to access those links you saher, but none of them are accesible.

    Thanks a lot for the information you shared, helps my a lot to understand this technology. But I'm trying to create an application consuming that services but I don't find any documentation.

    Thanks!

    ReplyDelete
  5. I’m sincerely suggesting your blog to all my friends… I’ve changed myself in many thing after reading your blog… Thanks and keep going.
    Document Management Software Dubai
    Document Management Software
    Document Management Software UAE

    ReplyDelete
  6. Hi

    I´m get a new Job (Thanks God). Here we used eDOCS DM 5.3 and nobody know about it. This version is very old and I don´t have any support in my country.

    Now we are going to migrate to other system and I need to get certain information.

    What is the right way to know:

    1. How many documents are stored in eDocs DM.
    2. What is the total size of those documents for example

    for example 56,000 documents 500 GB

    I aprecciate your help, advice, etc.

    Regards...


    ReplyDelete
  7. I always like and such a super contents of these post, Good info I gained more information about that. Thanks for such a helpful information. Keep it up.
    Document Management Software India
    Document Management Software Chennai
    Document Management Software
    Electronic Document Management System

    ReplyDelete