Categories

Versions

You are viewing the RapidMiner Server documentation for version 9.1 -Check here for latest version

Call Web Service in Qlik Sense

This guide will walk you through the process of configuring and calling a RapidMiner Server web service via your Qlik Sense environment:

  1. Open Qlik Sense and click onCreate new app. On the popup window set the name and click on Create, the app will be created.
  2. Click theOpen Appbutton in the popup window.
  3. Click on theNavigation buttonon the left side and selectData load editormenu.
  4. On theData load editor, click theCreate new connectionand selectWeb file. Set the URL and the name.

    Note: If the web service requires authentication, the URL has to be modified to include user credentials as follows: http://username:password@web-service-url

    Example: http://admin:pass123@dev.www.turtlecreekpls.com:8080/api/rest/process/QlikSenseService?

  5. On the right side select the dataset by clicking on it. It will analyze the connection and give a preview of it. SelectHtmlasFile typeand (based on your data) choose appropriateField namesandCharacter set. You can select and unselect attributes.Field namestell Qlik Sense where to look for column names. If the first record contains the names of columns then theEmbedded field namessetting should be selected. If the data does not contain column names,No field namesshould be selected. RapidMiner always sends column names as first record soEmbedded Labelsis the setting to use.
  6. Press theInsert scriptand it will put the script to the main data management page. Qlik Sense will automatically create a data loading script.
  7. When theData load button is clickedon the right side, Qlik Sense will call the RapidMiner web service and RapidMiner Server will execute the process behind the web service. Depending on the complexity of your process and the amount of data, this step can take some time. Once RapidMiner server has executed the process and all data is received by Qlik Sense, a new window will open.
  8. The data is now in Qlik Sense and ready to use. ClickNavigation buttonagain and selectApp overview. Here you can add new sheet and create a dashboard.
  9. Now that the two tools have been connected and data is pulled from RapidMiner Server to Qlik Sense, data can be used to build dashboards. Data can also be refreshed on demand by going to theNavigation buttonon the left side and selectData load editormenu. Once the editor is opened clickLoad Dataon the top right corner. On data reload, the script will call the RapidMiner web service again and receive fresh data back.

Call Parameterized Web Service

It is possible to configure a RapidMiner Server web service toaccept URL query parameters. Qlik Sense offers two ways by which a parameterized web service can be called:

Before being able to exploit these features Qlik Sense requires someinitial configuration.

Qlik Sense Configuration

To be able to call an external web service with dynamic parameters, Qlik Sense must be configured to allow the data loading scriptlib referenceto be取而代之的是实际的URLas well as two specificextensions need to be installed.

Using URL references

By default Qlik Sense replaces the URL with which adata connectionwas setup with alib referencein the data loading script

To change this behavior theSettings.inifile needs to be changed to enableLegacy Mode. This is done by setting theStandardReloadvariable value to 0
TheSettings.inifile can be usually found in two locations:

  • C:\Users\{user-name}\Documents\Qlik\Sense
  • C:\Users\{user-name}\AppData\Local\Programs\Qlik\Sense\

If the file is present in both locations then you need to update it twice, once for each location.

Qlik Sense Extensions

Qlik Sense Extensions can be added to Qlik Sense by copying them to theC:\Users\{user-name}\Documents\Qlik\Sense\Extensionsfolder. For this guide the necessary extensions that need to be installed are the following:

Using Data Loading Script

Parameters are passed through the URL of the web service. To be able to pass parameters, the data loading script has to be modified.

  1. OpenData load editorpage fromNavigation menu.
  2. Locate the URL of web service and add parameters to URL, by clicking on theEdit Connectionoption or by copying the URL directly to the script replacing the “lib://“ statement and edit the script.

    Be sure to add the URL within the square brackets, if you remove them the data loading script will fail

    Parameters are added to the end of the web services URL preceded by a question mark (?).
    Syntax: http://username:password@web-service-url?param-name=value

    Example: http://admin:pass123@dev.www.turtlecreekpls.com:8080/api/rest/process/QlikService?p0=1

  3. Save the script by pressingCTRL + Sor going toFile > Save.
  4. Reload the script by pressing theLoad Data.

Using Qlik Sense Variables

To be able to pass Qlik Sense variables as parameters to a RapidMiner web service, variables have to be defined in Qlik Sense and a data load script modified to use them.

  1. To create Qlik Sense Variable go toEditon the dashboard sheet and select the Variables button on the left bottom. The following window will pop up.
  2. Click onCreate new按钮,填补它在th并单击save按钮e top right corner.
  3. The new variable will appear onVariableswindow.
  4. Create newVariableobject on Qlik Sense dashboard (or use existing). Such objects can be created once theVariableextension has beeninstalled to Qlik Sense.
  5. Select the object and on the right side there is theAppearance窗格l.
  6. Setup the variable name, style and other settings in theVariable menu.
  7. To add values click onAdd Alternativeand add the desired value and the label that you would like to use.
  8. Create aSheet Navigation & Actionobject on the dashboard. Such objects can be created once theSense Navigationextension has beeninstalled to Qlik Sense.
  9. InActionsmenu in the properties window on the right enable theActions before Navigationoption.
  10. SelectSet Variable Valuefrom the First Action dropdown list and add the Variable Name.
  11. Click on theNavigation buttonon the left side and selectData load editormenu
  12. Locate the URL of the web service and add parameters to the URL. Parameters are added to the end of the web services URL preceded by ? (question mark).

    Parameters are appended to the end of a web service URL string, preceded by a question mark (?).
    URL syntax: http://username:password@web-service-url?param-name=value
    Qlik Sense variables can be referenced with the following syntax: $(variable-name)

    Example: http://admin:pass123@dev.www.turtlecreekpls.com:8080/api/rest/process/QlikSenseService?p0=$(Variable1)

  13. Save the script by pressingCTRL + Sor theSavebutton.
  14. Reload the script by pressing theLoad Databutton.
  15. Data will be reloaded with parameter value equal to variable value.
  16. 你也可以添加一个Reloadbutton to the dashboard directly allowing users to load data easier.
  17. After adding theQlik Sense Reload Buttonextension to the appropriate directory (Documents/Qlik/Sense/Extensions) add theReload Btnobject to the dashboard.