Categories

Versions

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

调用Web服务QlikView

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

  1. Launch QlikView and go toFile > Newto create a new empty QlikView document.
  2. PressCTRL + Eor go to文件>编辑script. The script editing page will open.
  3. On theDatatab, click onWeb files:
  4. A newSourcewindow, where the data source is configured, will open. Select theInternet Fileradio button and insert the direct link of the RapidMiner web service in the text box provided and click Next.

    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

    例如:http://admin: pass123@dev.www.turtlecreekpls.com: 8080/api/rest/process/QlikViewService?

    When the Next button is clicked, QlikView will call the RapidMiner web service and as a result, 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 QlikView, a new window will open.
  5. SelectHtmlasFile typeand (based on your data) choose appropriateLabelsandCharacter Setvalues. Click the Next button.

    Labelstell QlikView where to look for column names. If the first row contains the column names then theEmbedded Labelssetting should be selected. If the first row does not contain column names,Noneshould be selected. RapidMiner always sends column names in the first row soEmbedded Labelsis the setting to use.

  6. On theTransformwindow, click theNextbutton (as all data have already been transformed and prepared to be read by QlikView).
  7. TheOptionswindow can be used to further filter input data if needed. Once finished, click theNextbutton.
  8. The last window will show a QlikView load script. No action is required so simply click theFinishbutton. QlikView will automatically create a data loading script. Click theOKbutton:
  9. The data loading script is created but in order to use it, the script must be saved. Go toFile > Saveand save to a location of your choice.
  10. The last step is to load the data in QlikView. To do that, pressCTRL + Ror go toFile > Reload.
  11. The data is now in QlikView and ready to use. To view data table pressCTRL + Tor go toFile > Table Viewer. Now that the two tools have been connected and data is pulled from RapidMiner Server to QlikView, data can be used to build dashboards. Data can also be refreshed on demand by going toFile > Reload或按CTRL + T. 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. QlikView offers two ways by which a parameterized web service can be called:

  • Statically using a data loading script
  • Dynamically using QlikView variables

Using Data Loading Script

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

  1. PressCTRL + Eor go to文件>编辑script. The Edit script window will open.
  2. Locate the URL of web service and add parameters to URL.

    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

    例如:http://admin: pass123@dev.www.turtlecreekpls.com: 8080/api/rest/process/QlikViewService?p0=1

  3. Save the script by pressingCTRL + Sor going toFile > Save.
  4. Reload the script by pressing theCTRL + Ror going toFile > Reload.

Using QlikView Variables

To be able to pass QlikViewVariablesas parameters to a RapidMiner web service, they have to be defined in QlikView and the data loading script has to be modified to use them.

  1. To create a QlikView Variable go toSettings > VariableOverview or pressCTRL + ALT + V
  2. Click theAddbutton, enter the name of variable and clickOKbutton to accept.
  3. Then click theOKbutton onVariable Overviewwindow.
  4. Create a new object (like a button) on QlikView dashboard or use an existing one.
  5. Right click on the object and select Properties.
  6. In the Text box enter the name of your object.

  7. Go toActionstab and clickAddbutton.

  8. AsAction TypeselectExternaland asActionselectSet Variable. Click theOKbutton.
  9. Under theActionslist box,Set Variablewill appear. On the right side open variable selection window by clicking thebutton.
  10. AnEdit Expressionwindow will open. Click on theVariablestab, choose the variable from the dropdown menu and clickPastebutton.
  11. Click theOKbutton to accept changes.
  12. On the right hand side, enter theValueof your variable in the corresponding text box and click theOKbutton.
  13. Click on the object to apply the new variable value.
  14. Open the data loading script window by going to文件>编辑Script或按CTRL + E.
  15. Locate the URL of the web service and add the QlikView variables as parameters to the URL.

    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
    QlikView variables can be referenced with the following syntax: $(variable-name)

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

  16. Save the script by pressingCTRL + Sor going toFile > Save.
  17. Reload the script by pressing theCTRL + Ror going toFile > Reload.
  18. Data will be reloaded with parameter value equal to variable value.