Qlik Community

QlikView Documents

Documents for QlikView related information.

Announcements
Announcement: Certain actions are currently causing a Page Not Found error. This is a known issue and we are working with the platform vendor to investigate and resolve it.

Using EDX in QlikView 11 - basic example

Employee
Employee

Using EDX in QlikView 11 - basic example

EDX is a trigger mechanism for starting a QlikView reload or task from an external source, such as a scheduler or application. To start a task using EDX the QlikView Management API must be used and this is delivered in the form of a Web Service.  The full details on EDX in QV 11 plus a detailed example and code is available here :  http://community.qlik.com/docs/DOC-2650

Below is a step by step simple example which may help you start to develop something for your own needs.  For this example you will require and need to be familiar with Visual Studio (the free version is fine, although the attached project is for Visual Studio 2010 pro) to write your application and you will need to under stand how to use QlikView management API. 

Step 1 - Create a task

First of all create the task you want to trigger, this can be any type of task and do this using the QlikView management account as normal.  For the task create a trigger, and for the type of trigger chose "On an external Event" and you need to specify a password that will be used to call the task (this isnt used anywhere else except for starting the task).  The below works both if you have a fully license Publisher but also if you just have server but the task creation screen in the QMC is slight different for each.

Step 2 - Create your application to us the API

We are going to use the QlikView management API to build an application that will start the task, the application itself could take any form such as web page with a button (like the attached) a command line app, a web service; whatever suits your business needs. The attached example is build as a .net web page with a button a user could click but the code can be lifted and moved to another application type. 

Its worth point out that this is the bare essentials for using EDX, it does not include things like task monitoring or error handling,  examples of more complex features can be seeing the above referenced document.

The attached project is pre-configured to use the QliKView Management API and below is just the code required to start a task,  refer to the documentation on how to get started with using the API as this can be a bit tricky to get used to.  I have used C# on a asp.net page and many examples will use this but you can use other languages and technologies also.

Open the attached project and you can review the key lines in the project by looking at the following:

First we will declare some variables we need to use,  the address of your QlikView server,  the name of your task (or its ID), and the password you specfied in the task.  Typically you would want to put these in a config file or allow them to be passed as parameters.

            string QMSURL = "http://localhost:4799/QMS/Service";

            string Taskname = "Reload of Golf Quest.qvw";

            string Taskpassword = "secret";

Second we will need to handle the Service Keys used to talk to the API, this needs to be done to call any function in the API, refer to docs for more details on this

            QMSClient Client;

            Client = new QMSClient("BasicHttpBinding_IQMS", QMSURL);

            string key = Client.GetTimeLimitedServiceKey();

            ServiceKeyClientMessageInspector.ServiceKey = key;

Finally the real part of the code example, calling the task.  It can be as simple as just one line as shown below or more complicated. 

            Client.TriggerEDXTask(new Guid("00000000-0000-0000-0000-000000000000"), Taskname, Taskpassword, "", new string[0]);

Breaking this line down the function "TriggerEDXTask" has 5 parameters

  1. The GUID of the QDS - this isthe identity of the reload component in QlikView, this might be the basic one attached to a server or a full Publisher, its actually the same service.  With publisher the GUID might be something different to the blank one above however the above line should work in both cases. If you have them on different servers, or more than one publisher you need to give the full and correct GUID.
  2. Taskname or GUID - fairly self explanatory the name of the task in the QMC, or its ID
  3. Task Password is the password you specified in the task
  4. Parameter name - When starting the task you can pass a variable into the reload script if needed, ive left it blank in this example
  5. Parameter values - the values for the above.

OK thats it, of course there is plenty more that could be done here but this is the basics. It is also possible to monitor the task for completion.

Step 3 Security & Running your code

To be allowed to request something from the API, the user or the code calling the function needs to run as an account with particular permissions.  These are windows permissions defined on the QlikView Server as two local groups, users must be in either the QlikView Administrators or QlikView EDX groups. The later of these is not created by default.

Depending on what type of application you build the way the users name gets to the Management Service can vary.  If the code is built into a windows exe file this will run as the user currently logged into windows. If it runs as a web page it will by default run as the identify of the application pool in IIS depending on it is set up and this might not be correct. 

The attached example uses imponsation, that is that the ID of the user logged into the web page will be passed along to the QlikView API.  You can see this being turn on in the web.config file with the line  <identity impersonate="true"/>.  IIS needs to be configured to allow this to work by requiring windows authentication on the page and for the application pool to run in classic mode.  In this scenario every user who might call the function needs to be in the groups mentioned above, while this is quite granular it might be administation you dont want to have. Also if the application is being called by a non-windows source such as a Unix based scheduler this may give issues.

An alternative is to modify the code so that a single user name is used to connect to the API on the behalf of all users, of course you needs to factor in some way of ensuring only permitted users can then use the application.  To do this modify the code as follows.

After the line Client = new QMSClient("BasicHttpBinding_IQMS", QMSURL); place the following lines

            WindowsClientCredential creds = Client.ClientCredentials.Windows;

            creds.ClientCredential.UserName = "myadminaccount";

            creds.ClientCredential.Password = "mypassword";

This will now call the API using the hardcoded credentials, although these should be saved in a config file.

Good luck and i hope this example helps

Labels (1)
Attachments
Comments
Not applicable

How do I monitor my task for completion?

Employee
Employee

There is an additional function within the API for monitoring the task through to completion.

There is a more detailed example of how to use this function in this post http://community.qlik.com/docs/DOC-2650

0 Likes
MVP & Luminary
MVP & Luminary

Hi,

has someone already developed an EDX extension object where a user could start a task from within the QV AP?

- Ralf

0 Likes
Not applicable

Hi All,

We have been attempting to follow through the EDX documentation for QV11 and have run into several road blocks when attempting to follow along with the example code.

We are using QV11

VS2010

.net framework v4.0.30319

When we attempt to create the service reference it is stored in the solution explorer/project as a web reference.

Here are the steps we are taking to create the service reference;

1) Right click on the project in solution explorer and from the menu select add service reference

2) In the address dropdown we are selecting: http://localhost:4799/QMS/Service

3) From the services box we select QMSBackendService

4) We name the service

5) Select Ok

Capture1.PNG

The issue is instead of coming back with a service reference like the example we get a web reference:

Capture2.PNG

Our build options for the project have the target framework as .Net Framework 4.

Are we missing a step here or let us know what we are missing?

Dirk

0 Likes
Not applicable

Hello Joe

Not a C+ or Visual Studio user here.  Hoping that one can edit the Web.confg file in your example to at least trigger an EDX task

Looking over your notes I'm wondering if you can share with us what the actuall coding is.  I see that your notes for:

string QMSURL = "http://localhost:4799/QMS/Service";

string Taskname = "Reload of Golf Quest.qvw";

string Taskpassword = "secret";

are handled in the Web.config by:

  <appSettings>

    <add key="QMSAPIURL" value="http://localhost:4799/QMS/Service"/>

    <add key="Taskname" value="Reload of Golf Quest.qvw"/>

    <add key="TaskPassword" value="secret"/>

  </appSettings>

-----

What might be the proper syntax for:

------

QMSClient Client;

Client = new QMSClient("BasicHttpBinding_IQMS", QMSURL);

string key = Client.GetTimeLimitedServiceKey();

ServiceKeyClientMessageInspector.ServiceKey = key;

------

Client.TriggerEDXTask(new Guid("00000000-0000-0000-0000-000000000000"), Taskname, Taskpassword, "", new string[0]);

------

WindowsClientCredential creds = Client.ClientCredentials.Windows;

creds.ClientCredential.UserName = "myadminaccount";

creds.ClientCredential.Password = "mypassword";

-----

Thanks in advance if you can provide any insight.

0 Likes
Employee
Employee

Hi Ralf, 

Yes i have mocked up something as an example.  In Qlikview there is a simple extension object that just embeds any web page you want into a QVW.  I built a .net web page hosted it in IIS on my QlikView server and then displayed that page in my QVW via the extension object.

For my example i did a few extra things.  Firstly i made it so that a reload couldnt be started more often than every 15 minutes,  allowing users to trigger reloads is potentially dangerous as if 10 people do it at the same time its going to put pressure on the server and data sources and really it doesnt make sence to do it.   Secondly i made it so that only certain users would be able to hit the "reload" button on the webpage but no matter who you are you get to see if the reload is currently running or the time is last ran.

The example needs a bit of polish but i will try and send it to use via drop box in a personal message and publish a pucker one later.

Joe

0 Likes
Employee
Employee

Hi Dirk,

No its fine,  your project type is a "web project" ie your building directly into a folder in IIS and the folder naming is slightly different from the ".net Web Application Project" i have used.  It should still work the same way however.

Joe

0 Likes
Employee
Employee

Hi Stoney,

Im not sure i follow your question.  You should pretty much be able to change the settings in web.config to point to your environment and run a task of your chosing.

Those extra lines of code are not in this basic example but you could use something like those to be able to interact with the API using a different account but im not sure what your objective is.

Joe

0 Likes
Not applicable

Thanks Joe for the quick response. We are still having some trouble getting EDX up and running but at least we know the reference is properly set.

Dirk

0 Likes
Not applicable

Joe

Thanks for the reply.  Sorry I wasn't clear.  I'm trying to determine what the syntax tags might be for the following in the Web.config, if manually added:

WindowsClientCredential creds = Client.ClientCredentials.Windows;

creds.ClientCredential.UserName = "myadminaccount";

creds.ClientCredential.Password = "mypassword";

An example:

    string QMSURL = "http://localhost:4799/QMS/Service";

When added into Web.config becomes"

     <appSettings>

         <add key="QMSAPIURL" value="http://localhost:4799/QMS/Service"/>

         ....

     </appSettings>

0 Likes
Version history
Revision #:
1 of 1
Last update:
‎2012-04-27 07:50 AM
Updated by: