QlikView Management Service API and .Net

This article introduces the QlikView Management Service (QMS) API and how you can make use of it within a .Net application. I will focus on .Net 4.5 and QlikView 11.2 and assume that you understand, at least at a high level, .Net, adding Service References and that you also want to see how these can be used within the QlikView Server environment.

Sometimes programmers want to expose certain aspects of their system in order to interface with other systems. One of the ways they achieve this is via an Application Programming Interface or API. An API is typically exposed via a class library and can be included within the code of another application. This allows the developer to write code that makes use of some of the functions, classes and objects contained within the software’s original source code. QlikView allows us to do this.

Within QlikView Server there are multiple separate services that are installed that operate independently of one another. There is a single service within QlikView that is installed that can often be thought of a construction foreman, the guy that makes sure the work is being done. This service is called the QMS, the QlikView Management Service. You can see all the installed services within a complete install in the screenshot below (non IIS install).


The QMS keeps track of many different things such as the name and number of tasks currently running on the server, bookmarks and server objects among many other items. One of the APIs that QlikView provides is the QMS API. There is documentation that accompanies this API that is listed at the bottom of the article. We can interrogate the QMS API via code to perform many different functions and in some cases ease the pain a little for a QlikView System Administrator.

To make use of the API there are a few requirements that need to be handled. The application must be built on the .Net framework. A group must be created on the target QlikView server that the QMS service is installed on and it must be named ‘QlikView Management API’. Add to this group the users that will be making the service request calls. In most cases this most likely will be the same Active Directory group or users that are in the ‘QlikView Administrators’ group. A logoff and logon is needed for a user added to this group’s membership to take effect.


The next step is to create an application that has a Service Reference that points to an installed and running QMS on a target server. The following screenshot is from a WinForm application within Visual Studio in the process of adding a reference to http://localhost:4799/QMS/Service. During this import Visual Studio makes entries for the bindings and endpoints within the applications configuration file. As a result of this a proxy is now available to the application that can communicate with the QlikView QMS.


Code can now be written that interacts directly with the QMS. There are plenty of classes to support many common tasks. The following screenshot shows the classes that are now available after adding the Service Reference.


In order to directly make use of this namespace and the classes, Visual Studio needs to be instructed to import them. The following screenshot shows the needed C# using statement within the form.


In order to keep the security reigns tight the QMS requires that every request to it be authorized. Since this is an HTTP service, every single HTTP request must have within its header a service key that represents the users session with the server. This is referred to as Service Key Injection. QlikView has provided three helper classes for performing the required modifications to the HTTP headers. Download the zip file from here and extract the folder. Create a folder named ServiceSupport within the Visual Studio project, and then move the files extracted from the zip to the folder created within the project. The screenshot below shows the project structure. The additional screenshot shows that the classes that were extracted also have to match the project namespace.



The one reaming component that is required to complete the use of the QMS API setup is the modification to the projects configuration file. The screenshot below shows the modified app.config of a WinForm application. Even though the serviceKeyBehaviour is highlighted in blue below, it is a highly critical entry. This is what instructs Visual Studio to modify the HTTP header of each request.


Below is a screenshot of the completed class used within a WinForm application.


Now while the code above is nowhere near production ready here is a screenshot of the output from the call to the _client.GetServices method.


This article introduced you to the QMS API and how to make use of it within a .Net application. With these two technologies combined not only can QlikView documents themselves be delivered in a variety of ways but the job of a QlikView System Administrator can also be made easier by developing tools to aid in common tasks or those that are lacking within the Management Console for the server.
Until next time, happy coding!


, , , , ,

Comments are closed.