Processing POST Data, Form Data, and Uploaded Files (Real-Time, Windows)

Parent Topic: Developing Web Services

When a web client sends an HTTP request to a Web service, the Web service accepts the request and routes it to the HTTP method VI specified in the URL. That HTTP method VI uses the connector pane and VIs on the Web Services palette to process the request and return a response. A web client might send data by appending values to a URL or by using standard HTML forms configured for HTTP methods such as POST.

Note��For more information about concepts in this topic, refer to the Web services introduction and tutorial. LabVIEW Web services are available only in the LabVIEW Full Development System and the LabVIEW Professional Development System.

Configuring the HTTP Method VI

To configure an HTTP method VI to accept POST data, set its HTTP method as POST. Right-click the VI in the LabVIEW project and select POST.

Developing the POST HTTP Method VI

By default, a web client submits a URL with values that correspond directly to controls of the HTTP method VIs. The HTTP method VIs use the connector pane to route the values to the controls. You also can configure the HTTP method VIs to return the stream output data on the HTTP Method VI Settings page of the Web Service Properties dialog box. For more advanced data, you can use the VIs from the Web Services palette to process the data from the web client's request. Use the following VIs to accept form and POST data:

You must wire a LabVIEW Web Service Request control to the connector pane of any HTTP method VI that receives POST data and includes VIs from the Web Services palette.

Accepting Uploaded Files from a Web Client

LabVIEW stores information about each file uploaded by a web client in an array of clusters. The information for each uploaded file includes the client filename, the path to the temporary location, the content type, and the size (bytes). When you develop HTTP method VIs, include the Read Uploaded Files Info VI to return information regarding all uploaded files associated with an HTTP request. Use this information to perform actions on the uploaded files, such as moving them to a permanent location.

You must wire a LabVIEW Web Service Request control to the connector pane of any HTTP method VI that receives uploaded files and includes the Read Uploaded Files Info VI.

Data Communication Methods Home