Creating Webservice data sources


The data source input mask opens, in which you can select the Webservice data source as "Type" as a first step. However,

if you first assign a name to the data source and if this contains the word "webservice", then "Webservice" is already preselected

as the data source type. (This works with all data source types)



After this, the data source-specific settings adapt automatically to the Webservice data source.




Webservice Specific:


The Webservice data source is used to exchange information with a web service.

Data must be transferred in “JSON”, “XML” or “URLEncoded” format.



Read:



  • Request Method

Some web services expect certain request methods for reading data. Here you determine the request method for reading the data source.

The request methods “GET”, and “POST” are available here.


  • URL

The URL that will be called to read data from the web service. 

The use of placeholders (see below) is allowed.


  • Parameters

Additional parameters to be transferred to the web service together with the read request.

Supported formats here are also “JSON “, “XML”, and “URLEncoded”. The use of placeholders (see below) is allowed.


To enlarge the input field and thus write better, use the glass icon next to the text field.




Write:



  • Request Method

Some web services expect certain request methods for writing data. Here you determine the request method for writing the data source.

The request methods “GET”, “POST” and “PUT” are available here.


  • URL

The URL that will be called to send data to the web service (write variables). If no different write URL is specified,

the read URL will also be used for writing. The use of placeholders (see below) is allowed.


If there are problems processing the data in the web service, this can be communicated to the QuickHMI system so

that it can display a corresponding error message. For this, the server's response is expected in a certain format.

Response examples in the 3 supported formats can be found below.

As soon as the transmitted Quality deviates from “GOOD”, an error message with corresponding message is displayed in QuickHMI.



  • Parameters

Parameters that are sent to the web service together with a write request. By using placeholders (see below)

the variable to be written as well as the value to be written can be passed.


Examples of possible parameters for each format can be found below.


To enlarge the input field and thus write better, use the glass icon next to the text field.






  • Headers

In this section http headers can be defined.




With the plus button you can create new headers. To do this, you assign a header name and a header value.

You can create your own headers as well as select from a variety of predefined standards.

Multiple headers can be created with "Add" and deleted again with the "X".






The Authorization Header:


Some URLs expect authentication via username and password when called. The Authorization Header is used for this purpose.

If you select this, a key icon appears, which opens a new window. Here you can enter the login data expected by the server.

After confirming with "OK", the value field for the header is filled in automatically. So, the content for the Authorization Header can be

generated automatically by entering the username and password. However, this is optional and can also be filled in manually.




Placeholders:



Placeholders can be used in the URLs and parameters to call up variable-specific URL´s or send variable-specific parameters.


The following placeholders are available:


  • @var_name

Contains the name of the variable in the QuickHMI system.


  • @var_path

Contains the path within the “JSON” or” XML” structure. In case of “URLEncoded” data only the key is included.


  • @var_value (Only for write requests)

Contains the value to be written.



By using placeholders in the read URL or the read parameters, a separate request is sent to the web server for each variable.

For many variables, the use of such placeholders can lead to performance losses. This restriction does not apply to writing,

since a single request is sent for each variable anyway, regardless of the use of placeholders.




After entering the information relevant for the connection, click on "Add". And after editing an already created data source, click on "Save".




The Webservice data source is created and subsequently displayed in the data source overview.




Created data sources can be edited or deleted. You do this via the corresponding buttons.

You also have the option of viewing all internal data sources. This works by activating the checkbox "Show internal data sources".


Below you can create variables for the Webservice data source.

You can find out how to add variables for the Webservice data source in the “Adding Webservice variables” chapter.


>> Adding Webservice variables