NI Labs Toolkits

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW HTTP Client

Summary

The LabVIEW HTTP Client provides an API for interacting with web servers and web services.

The HTTP Client allows the following use cases:

  • Supported HTTP methods are GET, POST, and HEAD
  • HTTP client sessions can be opened for efficiency or to use server cookies.
  • Custom HTTP headers can be added to a request.
  • Encoding/Decoding Base64

The HTTP GET method
GET.png

Details / HTTP Crash Course / Technobabble

A description of the HTTP standard can be found on Wikipedia.

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol

HTTP is the protocol used on the web to request resources and upload or download data. During an HTTP transaction, a client will make a request to a server. The request will include a version, an HTTP method, other headers, and possibly a body. The server's response will be very similar and will also include headers and a body.

The various methods cause the server to take different actions based on the request.

The methods allowed by HTTP are enumerated in the above article. Of the methods supported by this HTTP client:

  • GET is used to retrieve a resource. Data is not included although parameters may be sent by encoding them in the requested URL.
  • POST is used to upload data. The data is included as the body of the request.
  • HEAD instructs the server to send only the header portion of the response. This is useful for checking modification dates on files for caching algorithms.

HTTP is a stateless protocol. Each request is independent from the others. The server can't differentiate related requests and therefore does not have the ability to save state between requests. In order to get around this shortcoming of HTTP, servers use a bit of data called a cookie. A cookie is defined by the server in a special header when a request is sent. The HTTP client will save the cookie from that header and with subsequent requests the client will include the cookie in its own headers. Using this mechanism the server can associate a series of requests and create a consistent session for the client.

The LabVIEW HTTP Client allows cookies when a client session is created. All cookies sent by the server will be saved by the client. At this time it is not possible to save these cookies to a file to allow them to persist between executions of the application.

Finally, the LabVIEW HTTP Client provides a VI to add custom headers. If custom headers are added to a client session, they will be sent with every request made in that session. This is useful when interacting with web services that use header information.

Installation

This version of the LabVIEW HTTP Client works on Windows, Pharlap, and VxWorks. Mac and Linux version will be forthcoming shortly.

Unzip the attached file. Run the enclosed setup.exe

This will install the HTTP Client VIs to the LabVIEW 2009 user.lib directory. The palette can be found under the 'User Libraries' palette.

If using on Pharlap or VxWorks the .dll/.out file must be copied to the \ni-rt\system\ directory on the target. The libraries can be found on the host in LabVIEW\user.lib\_HTTP Client\

The pharlap library is named ni_httpClient.pharlap.dll. It needs to be renamed ni_httpClient.dll. The VxWorks library is name ni_httpClient.out.

Usage examples are installed in user.lib\_HTTP Client\Examples

Note

This API is under development and will change.

We are interested in your feedback. Feel free to send us your suggestions.

Download All
Contributors