16 Replies Latest reply: Nov 7, 2012 12:50 PM by mjaskiewicz RSS

    Remote triggering of QlikView 11 tasks from Java

       Folks, I have been trying to identify if we can remotely trigger tasks in QlikView Publisher using Java. EDX initially appeared to be the way to go, but as per this article: [http://community.qlik.com/docs/DOC-2650], it can only be used with a client written in .NET. I am surprised that a web service cannot be accessible using simple HTTP! According to Rakesh Mehta in http://community.qlik.com/message/186385#186385, the web service should be accessible using any technology, but this appears to be contrary to posts made by Arthur Lee. Could someone please resolve this doubt?                                                       Our system is an automated one where we will need to trigger: 1. Document reloads.  2. File operations such as move/rename/copy, etc.  If EDX cannot be triggered using a non-.NET system, could someone please suggest an approach that will help our requirements?  Thanks!

        • Remote triggering of QlikView 11 tasks from Java

          BTW, I'm not sure why the forum software is not letting me add newlines. Sorry for the humongous paragraph!

          • Remote triggering of QlikView 11 tasks from Java

            .Net is not required; it's just that most examples use .Net. The EDX trigger is part of the QMS API and the api is a webservice. Therefore you can trigger an reload with an http request (although you should probably use a soap library). The only requirement is that the API uses NTLM authentication (take a look at jcifs project for an open source solution).

              • Remote triggering of QlikView 11 tasks from Java

                Sorry for the delayed response, but thanks vhuynh! Is there any way we can get documentation on the webservices? Docs that I have seen say the the QMS API doc is available in the management console. I don't have access to a QlikView server yet, and am trying to design these API calls before I get access. How can I get the API documentation?

                  • Remote triggering of QlikView 11 tasks from Java

                    Unfortunately I have not found any good documentation for the apis. You can get wsdl from http://hostname:4799/QMS/Service?wsdl or download PowerTools but without a qlikview server available you will not know exactly what each api does. The api will make more sense if you have qlikview server (even one without a license installed since setting the license is something the api can do).

                     

                    Here are somethings to keep in mind:

                     

                    • The authentication is NTLM and the user must be part of the "QlikView Management API" group.
                    • Even though most parameters are listed as optional, most are required.
                    • Use the GetTimeLimitedServiceKey api and set the result in the X-Service-Key http header to call an api.
                      • Remote triggering of QlikView 11 tasks from Java
                        Arnold Ayaoan

                        Hi Vhuynh,

                         

                        Kindly post a sample code in implementing the web service in Java.

                        I've trying to use the web service in Java but I'm getting the below error:

                         

                        Exception in thread "main" AxisFault

                        faultCode: {http://xml.apache.org/axis/}HTTP

                        faultSubcode:

                        faultString: (401)Unauthorized

                        faultActor:

                        faultNode:

                        faultDetail:

                            {}:return code:  401

                         

                            {http://xml.apache.org/axis/}HttpErrorCode:401

                         

                        (401)Unauthorized

                            at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)

                            at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)

                            at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

                            at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

                            at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

                            at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

                            at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

                            at org.apache.axis.client.Call.invoke(Call.java:2767)

                            at org.apache.axis.client.Call.invoke(Call.java:2443)

                            at org.apache.axis.client.Call.invoke(Call.java:2366)

                            at org.apache.axis.client.Call.invoke(Call.java:1812)

                            at org.tempuri.BasicHttpBinding_IQMSStub.getTimeLimitedServiceKey(BasicHttpBinding_IQMSStub.java:7533)

                            at javaapplication5.JavaApplication5.main(JavaApplication5.java:52)

                         

                        CODE:

                        public static void main(String[] args) throws Exception {

                        BasicHttpBinding_IQMSStub service = (BasicHttpBinding_IQMSStub) new QMSBackendServiceLocator().getBasicHttpBinding_IQMS(new URL("http://192.168.235.128:4799/QMS/Service"));

                        System.out.println(service.getTimeLimitedServiceKey());

                        }

                         


                        Please help. Any response is appreciated.

                         

                        Thanks,

                        Arnold

                          • Remote triggering of QlikView 11 tasks from Java

                            The 401 error occurs because of the NTLM authentication. You will need to implement NTLMv2 authentication. You can use the jcifs library to do most of the work. The library will need to be integrated with axis and the implemenation is specific to the version of axis that you're using.

                              • Re: Remote triggering of QlikView 11 tasks from Java
                                Arnold Ayaoan

                                Hi Vhuynh,

                                 

                                I just learned that QMS API will not allow me to retrieve the rows and columns of TableBox objects within a qvw documents.

                                 

                                Are you aware of a plugin/API that will allow me to do the following:

                                1. Connect to QlikView server and retrieve the list of qvwdocuments
                                2. Browse to the sheets of the qvw documents
                                3. Retrieve the Objects within those sheets together with its values. Let say a TableBox together with its rows and columns.

                                And I need to do this in Java with QlikView 11.

                                We've done this before in older QlikView version using QvsComRemote.dll but this dll was retired already.

                                 

                                Kindly help give some ideas regarding this.

                                 

                                Thanks,

                                Arnold

                      • Remote triggering of QlikView 11 tasks from Java
                        Alexander Ekstrand

                        Anyone that could provide an example? we utilize this feature a lot, and now facing it's made very complicated in version 11.

                          • Remote triggering of QlikView 11 tasks from Java

                            Thanks for the info vhuynh, I managed to get my hands on a doc called "Using EDX in QV11", and in their own doc, they have mentioned: "This combination of security means the client application must be written in .NET".

                             

                            This doesn't make sense to me because there is no apparent reason why a web service cannot be accessible by a non-NET application, and vhyuynh also mentioned that you will not need .NET, but this text being placed in a QlikView design doc is making me a bit nervous.

                             

                            Any thoughts on this?

                          • Re: Remote triggering of QlikView 11 tasks from Java
                            Graeme Smith

                            We are triggering QDS tasks from Java/Scala apps.  For this I have created a simple facade in a .NET web service which I host in IIS on the server hosting the QDS.  The reason for doing this are as follows:

                            • encapsulation of QV API from other applications
                            • provides ability to implement more flexible and granular security layer. 

                             

                            I did not even attempt to integrate our Java/Scala apps directly with the QMS API directly for the reasons above - I don't want them having any knowledge about QV specifics (E.g. when I upgrade QV, I just need to update and regression test my facade, and not 100 consuming applications).

                             

                            I'm not directly answering your question, but if you haven't managed to get the java to QMS API integration working, then perhaps the above approach might work for you, as well as providing some additional benefits.

                             

                            Cheers,

                             

                            Graeme

                              • Re: Remote triggering of QlikView 11 tasks from Java
                                Arnold Ayaoan

                                Hi Graeme,

                                 

                                I'm very interested with you're approach.

                                Kindly give me more detail how did you encapsulate the QV API.

                                 

                                Thanks,

                                Arnold

                                  • Re: Remote triggering of QlikView 11 tasks from Java
                                    Graeme Smith

                                    Hi Arnold,

                                     

                                    There's not much to tell really.  I just created a new .NET web application, and wrote some services to expose the required functionality from the QMS API and implemented our own custom security layer on top of this (e.g. we only allow certain AD groups perform certain actions).   Additionally, we also capture statistics to a database for usage monitoring and audit trail. 

                                     

                                    The nice thing about this is that most consuming applications don't need much knowledge about QV specifically, so we just expose very generic methods (E.g. RunTask(taskID)).  If we upgrade QV or change the way it works behind the scenes, as long as we don't change the interface of the facade, none of the consumers need to know about it.

                                     

                                    Graeme

                                      • Re: Remote triggering of QlikView 11 tasks from Java
                                        Arnold Ayaoan

                                        Hi Graeme,

                                         

                                        I created a web service to wrap the qms api using the sample below code. Unfortunately I'm having a problem on the line highlighted because the code cannot locate QlikviewDistributionService and it returns null.

                                         

                                        Have you ever tried to use the QlikviewDistributionService?

                                         

                                        //START OF CODE

                                        IQMS apiClient = new QMSClient(); 

                                         

                                        //retrieve a time limited service key

                                        ServiceKeyClientMessageInspector.ServiceKey = apiClient.GetTimeLimitedServiceKey();

                                        ServiceInfo serviceInfo = apiClient.GetServices(ServiceTypes.QlikViewDistributionService).FirstOrDefault();

                                        if (serviceInfo != null) { QDSDocumentSessionConfiguration sessionConfig = new QDSDocumentSessionConfiguration();  sessionConfig.QDSID = serviceInfo.ID; sessionConfig.FilePath = @"C:\ProgramData\QlikTech\Documents\FastFood.qvw";  QDSDocumentSession documentSession = apiClient.CreateSession(sessionConfig);  if (documentSession != null && documentSession.OpenDocumentResult == DocumentState.OpenedSuccessfully) { List<Field> fields = apiClient.GetFieldList(documentSession); fields.ForEach(f=>Console.WriteLine(f.Name));  apiClient.CloseSession(documentSession); } else { Console.WriteLine("Failed to open the document."); } }

                                         

                                        //END OF CODE

                                         

                                        Thanks,

                                        Arnold

                                  • Re: Remote triggering of QlikView 11 tasks from Java

                                    Hi,

                                     

                                    I don't know if you already solved this but we had the same problem i.e. accessing the API from unmanaged code but a native Windows application. We simply created a .NET assembly that we call from the native application using COM Interop. It was pretty straightforward.