web services in labview maría del campo [email protected] ifca-csic, spain october 22, 2009,...

8
WEB SERVICES in LabVIEW María del Campo [email protected] IFCA-CSIC, Spain October 22, 2009, Garching

Upload: elena-woodman

Post on 02-Apr-2015

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

WEB SERVICES in LabVIEW

María del [email protected]

IFCA-CSIC, Spain

October 22, 2009, Garching

Page 2: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

LabVIEW is a graphical programming environment which offers unrivaled hardware integration and advanced analysis and data visualization tools.

Main features: Easy and quick programming. Hardware integration. Advanced analysis. Multiple targets and OS. Multiple programming approaches. Professional User Interfaces. Multicore programming. Support and Services.

What is LabVIEW?

Page 3: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

LabVIEW Web Services

Remotely monitor and control LabVIEW applications using custom thin clients, from any Web-enabled device.

Establish machine-to-machine communication using standard HTTP protocols.

Stream any standard MIME data types, such as text, images or videos.

Page 4: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

LabVIEW Web Services

RESTful architecture, which provides:

Firewall-friendly communication.

Minimal additional markup.

Defined by:URIMIME data type Set of operations supported using HTTP methods

Page 5: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

LabVIEW Web Services

Protocol: GET, POST, PUT and DELETE HTTP methods.

Data Transfer: Data streaming, server-side scripting (ESP), user session (cookies).

Applications development: HTML, JavaScript, but also Adobe Flex, Flash, AJAX, Microsoft Silverlight, Java applets…

Page 6: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

Instrument monitoring applications, as .exe files.

Set of LabVIEW web services built and deployed, available through POST and GET HTTP methods.

ECOHYDROS APPLICATION: Server side

Page 7: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

Client side very simple:

Base myREST class implementing basic HTTP operations over a certain WS endpoint.

This class is extended for each kind of sensor/service adding methods for creating and managing specific parameters/responses for each sensor/service.

Standalone Java implementation with no requirements for additional libraries.

package myREST;

import java.io.BufferedReader;import java.io.DataOutputStream;import java.io.IOException;import java.io.InputStreamReader;import java.net.HttpURLConnection;import java.net.MalformedURLException;import java.net.URL;

ECOHYDROS APPLICATION:Client side

Page 8: WEB SERVICES in LabVIEW María del Campo campo@ifca.unican.es IFCA-CSIC, Spain October 22, 2009, Garching

Messages interchanged with the Labview WS intended to be syntactically very simple.• Proccesing complex messages from LabView side adds unneccesary overload to the VI implementations.

Important to consider the time response of each device, which can result in a timeout error from the server.• Easy solution: Tune the value of the HTTP connection ReadTimeOut in java.

// Initializes the connectionconn = (HttpURLConnection) serverAdd.openConnection();conn.setRequestMethod("GET");conn.setDoOutput(true);// Timeout to be set accordingly to the Tribox sampling rateconn.setReadTimeout(100000); conn.connect();

ECOHYDROS APPLICATION:Issues