Transferring Application Data
NonStop Server application components such as Pathway servers, processes, and Enscribe files typically deal with input/output data as arrays or structures of binary data. For files, these structures are commonly referred to as records. For processes, these structures are referred to as interprocess messages or IPMs. For example, the reply IPM from a Pathway server that returns customer account balance information might look like this:
reply IPM data: "00112233445500010023JOHN DOE "
^^ - result code = 00
^^^^^^^^^^ - account number = 1122334455
^^^^^^^^ - balance = 1000.23
^^^^^^^^^^ - customer name = JOHN DOE
HTTP client applications transfer data to and from host applications in the HTTP request / response body. The format of the data in the body is specified using the HTTP Content-Type header.
JSON Content
The primary content type for LightWave Server data transfer is JavaScript Object Notation or JSON. The use of JSON as a web application content type has become extremely popular because it's light weight, human readable, more compact and easier to manipulate than XML, and is manipulated easily from JavaScript. There are also several high-quality API libraries that provide JSON parsers for languages other than JavaScript. These factors have combined to make JSON the de facto standard for modern web-based applications. This content type is indicated in HTTP request and response bodies using the HTTP Content-Type
header value application/json
.
In order to easily interact with existing NonStop applications LightWave Server provides mapping services that convert JSON formatted message data to and from the binary IPM and record formats expected by the NonStop application components. Mapping instructions are stored in LightWave Server Dictionaries and managed using the LightWave Server Console. Dictionary definitions and can be imported directly from NonStop DDL dictionaries if available. For example, the account balance reply IPM formatted as JSON might appear like this:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 114
{
"resultCode": "00",
"accountNumber": "1122334455",
"balance" : 1000.23
"customerName": "JOHN DOE"
}