Example Code

Secure Web Service: Login with NI Auth using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Description

Overview
This example shows you how to create a web service that requires a login with user data logging that can be used in a browser.


Description
The attached examples are a web service project for LabVIEW 2013, 2013 SP1, and 2014. It is the resulting code from following the tutorial listed in the Steps to Implement section. There is only one extra VI called Get Auth Details.vi. This allows the username to appear in the XML code once logged in. This example's intent is to help get you started with using security. Make sure to play around with different configurations.

Reminders

  1. All controls and indicators must be wired to the connector pane in order to send and receive data with web services
  2. You must publish your web service in order for people on the same network to access your web service
  3. Once logged in, each user will be able to access the VI until the browser is closed entirely to log in again
  4. To access your web service http://ipaddress:8080/WebServiceName/MethodName/X/Y for example

http://255.255.255.255:8080/SecureWebService/Add/1/2

 

Requirements

Software:

LabVIEW 2013(or compatible)

 

Steps to Implement or Execute Code

  1. Download the .zip file
  2. Set your desired configuration (a, x1, x2, degrees, etc)
  3. Run the VI

 

Additional Information or References
VI Block Diagram

1.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Brad S. | National Instruments | CLA

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Vigneshrk
Member
Member
on

Greetings,

Can you please explain why we have to uncheck API key. Will both NI AUTH and API key can be combined for web-service API.

Thanks.