Overview: Web-based Communication with a LabVIEW Application (Real-Time, Windows)

A web client can exchange data with a remote LabVIEW stand-alone application over a network through LabVIEW Web services. A Web service consists of VIs and other files running on a server that respond to HTTP requests from clients.

Note LabVIEW Web services are available only in the LabVIEW Full Development System and the LabVIEW Professional Development System.

Web services are useful in the following situations:

  • Users can invoke the Web service VIs with any HTTP-capable web client, including a standard web browser, to exchange data using a URL and standard HTTP methods such as POST. For example:
    • Uploading new parameters to an application
    • Retrieving current state or status
  • Users can remotely monitor and control embedded applications using custom thin clients. For example:
    • Updating application state
    • Starting or stopping a process
  • You can conduct application-to-application data exchange between numerous HTTP-capable devices and software from both National Instruments and third parties. For example:
    • Connecting to non-LabVIEW clients
    • Implementing security and authentication

Do not use Web services in the following situations:

  • Continuous data streaming
  • Rapid polling
  • Real-time processing

The following figure shows the common processes involved in LabVIEW Web service applications.

(1) Developing a Web Service

Web services enable communication between LabVIEW applications and web clients. Perform the following actions to develop a Web service:

  • On a host computer with LabVIEW installed, create and develop a Web service in a LabVIEW project.
  • Develop the fundamental components of a Web service, such as the HTTP method VIs and startup VIs.
  • Integrate static content files into the Web service.
  • Test and debug the Web service on a web server.

Related Information

Developing Web Services

(2) Hosting the Web Service

LabVIEW uses the NI Web Server or Application Web Server to host Web services on the network. The web server support for Web services differs depending on how you publish or run Web services.

Note The NI Web Server supports the Windows operating system only. The Application Web Server supports both the Windows operating system and RT targets.

You need to enable and configure the web servers before using them to host Web services. You can also establish secure communication between Web clients and LabVIEW Web services.

Related Information

Hosting Web Services

(3) Publishing the Web Service

From the project, you can perform the following actions to publish the Web service so that it can run without depending on the LabVIEW Development System:

  • Publish the Web service as a stand-alone Web service to the Application Web Server on the host computer or a connected RT target.
  • (Windows) Publish the Web service through an NI package to the NI Web Server.
  • Publish the Web service through a stand-alone application to the NI Web Server or Application Web Server on a Windows computer or an RT target.
  • Publish the Web service through a Windows installer to the Application Web Server on a Windows computer.

A Web service starts and stops running under different conditions, depending on how you publish it to the host server.

Related Information

Publishing Web Services

(4) Transferring Data between the Web Service and Clients

A web client, such as a browser, exchanges data with a Web service by sending an HTTP request to a specific URL. LabVIEW maps a URL to each HTTP method VI, so the specific URL that the client uses determines which HTTP method VI receives the HTTP request. The request might contain values to assign to specific parameters in the HTTP method VI. After each request, the HTTP method VI can process those values and return a response. The Web service returns data to the web client in a particular format that you configure, such as JSON.

Supported web clients include any HTTP-enabled platform, such as standard web browsers, HTML forms, third-party software, and VIs that use the HTTP Client palette.

You can implement communication between any Windows or Embedded LabVIEW application and a Web Service using standard inter-process communication methods. For example, you can use the Network Streams functions to locally transfer data from a LabVIEW application to a Web Service.

In a simple example, a web client might submit an HTTP request that contains two numbers to an HTTP method VI that calculates and returns the sum.

Related Information

Transferring Data between the Web Service and Clients

(5) Creating User Interfaces for Web Services

If you want to create user interfaces to view and interact with data from Web services in a web browser, you can develop Web User Interface (Web UI) applications using the G Web Development Tool. Use the G Web Development tool to create WebVIs, which are specialized VIs that generate HTML, JavaScript, and CSS files when you build your web application. WebVIs can interact with the web services using HTTP and display data in an HTML web page.
Note Although the G Web Development Tool simplifies the process of creating Web UIs, you can use third-party languages that support HTTP communication to create client user interfaces.