This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Publishing a G Web Development Software WebVI on an NI Linux Real-Time Target

Updated Nov 29, 2023

Environment

Software

  • G Web Development Software
  • LabVIEW

Operating System

  • LabVIEW Real-Time (NI Linux Real-Time)

This article will guide you through how to publish a built G Web VI onto an NI Linux Real-Time target. This will allow a Real-Time target (PXI or CompactRIO) to host a WebVI that users can connect to via a lightweight browser on a computer, tablet, or phone for human-machine interfaces.

Please note that you need to have the G Web Development Software installed in the development machine and NI Application Web Server on the RT target.


 

Building the Web Service on the Real-Time Target:

  1. If your LabVIEW project already has a Web Service on the Real-Time target, skip to the next section "Building the G Web Application".

  2. In LabVIEW, open or create a project targeting the Real-Time target.
  3. Add a new Web Service to the target by right-clicking and selecting New >> Web Service.LabVIEW_lPHmoF338G.png
  4. It is likely desired to add additional functionality to the Web Service, such as functions that can execute tasks when executed via HTTP calls such as GET/PUT/POST/DELETE.


Building the G Web Application

  1. If you do not have a G Web project set up, please refer to Developing a Web Application to set up a G Web Application
  2. Open your created .GWebProject in G Web Development Software.
  3. Create your webVI Front Panel as desired for users connecting.
  4. If you added HTTP calls that should be driven from the hosted WebVI, create actions on the G Web VI that can open and generate HTTP GET/PUT/POST/DELETE functions.
    • One example to take a value of "Example Input" to write a HTTP POST function to a named target address "POST_Example_Function" is below:GWeb_ZPow93KKDY.png
  5. Build the GWebProject by opening the .gcomp file and pressing "Build". This will create a folder in the specified Build directory that contains the contents of the web service to be hosted on a server. This can be located by right-clicking the Build Output -> Explore:
    •  
    • GWeb_pQBeVWUtOc.pngexplorer_011ZMoBea2.png


Adding the Built G Web VI into the Web Service

  1. In LabVIEW, right-click the Web Service and select "Add Public Contents Folder"
  2. Direct the public contents folder to the output folder of the above G Web Build.
    • This should result in something similar to the following:
    • LabVIEW_JXwAbVrHCY.png
  3. Deploy the Web Service by right-clicking the Web Service and selecting "Application Web Server > Publish".​​​​
  4. Right-click the Web Service (e.g. the Example_Web_Service in the above image) and click Start.
  5. In a web browser on a device on the same network as the Real-Time target, navigate to:
    • http://<Real-Time Target IP>:<WebService Port>/<WebService Name>/<Top-level GVI>.html,
    • e.g. http://192.168.2.212:8002/Example_Web_Service/index.html
    • Or you can right-click the HTML file (e.g. the index.html in the above image) and click Show Publick URL.
  6. You should be able to interact with the WebVI hosted on the target from here.
  7. To build this into a Real-Time application to e.g. start on boot, set the property of the "Build Specification -> Real-Time Application > "Web Service" to enable the Web Service, build and deploy the application:
    • LabVIEW_7JYf7LWodG.png