A "Web service" uses the infrastructure of the Web for machine-to-machine exchange of specific information. The Academic RIO Device can call Web services to retrieve information and can also host Web services to provide information to other systems.
Overview
What is a Web service?
A Web service uses the infrastructure of the Web for machine-to-machine exchange of specific information. Web services may also be known as “APIs” (Application Program Interfaces) and “JSON feeds” – JSON (JavaScript Object Notation) represents structured information in an easy-to-parse form.
Get a feel for web services by considering these example web service requests which are simply URLs that include query information; follow the links with your Internet browser:
http://ipinfo.io/ip – returns your public IP address as a simple character string. By contrast, http://ipinfo.io returns a conventional web page containing graphics and text – a page intended for humans.
http://ipinfo.io/city – returns the city name of your Internet Service Provider (ISP).
http://ipinfo.io/json – returns all available information about your Internet connection as a JSON (JavaScript Object Notation) string; programming languages including LabVIEW provide tools to easily extract needed information from this string.
How might calling a Web service be useful for my project?
See the API directory at ProgrammableWeb to get a sense of the enormous variety of information resources and tools available as web services. For example, your LabVIEW application running on the Academic RIO Device could look up information stored in a database, post a photo to Twitter or Instagram, check the current weather, or perform OCR (optical character recognition) to convert a webcam image of a document into text.
What should I know about calling a Web service?
A Web service provides a standards-based mechanism to exchange information between your client running on the Academic RIO Device and the server that implements the web service.
Forming the Web service endpoint URL is easy, and forming the query is as simple as assembling a string. Parsing the returned JSON string is also relatively easy because the LabVIEW JSON-related VIs are simple to use, although defining the necessary data type definition of the JSON string returned from a particular API may take some thought.
An Internet-capable wireless or wired network connection is required for the Device to access web services outside of your network domain. See ??? for suggested networking configurations for both wireless and wired access.
How might hosting a Web service be useful for my project?
A Web service provides a standards-based mechanism to easily exchange information between your Academic RIO Device and the remote client such as another LabVIEW-based target, an IoT device, or a conventional web browser. Your web service could make sensor measurements available to client machines, and can also control indicators and actuators using the commands obtained from the remote client’s request query string.
What should I know about hosting a Web service?
LabVIEW provides Web Services VIs to implement a web service that can be hosted on the desktop computer or RT host such as the Academic RIO Device.
You will need install the “HTTP Client with SSL Support” add-on to call a Web service
You will need install the “NI Application Web Server” add-on to host a Web service
Set the RT system time and date either with NI MAX or with your browser; the system date must be reasonably correct to call secure Web services, i.e., with “https” in the URL
Additional guides
Call a Web service – Learn the technical principles involved in calling a Web service that returns information in the form of JSON strings.
Host a Web service – Learn the technical principles involved in setting up a Web service on the Academic RIO Device.