Protocol Buffers

Please read the applicable Terms of Use.

Description

Protocol Buffers are a data serialization method developed by Google since 2001 and made public in 2008. It is widely used internally by Google.

Serializing (and deserializing) data is the transformation of an object to (and from) a stream of bytes, for storage and transmission purposes.

The aim of Protocol Buffers, which are open source and available in many languages, is to be simple and efficient, notably compared to XML. Unlike XML (and JSON), they use a binary format, only meant to be machine-readable (for message transmission), not human-readable.

In practice, Protocol Buffers are generally more efficient than XML and JSON, both in terms of size of the serialized data and of speed of processing. Their main drawback is a relative lack of support and community compared to these two other data formats.

Protocol Buffers are used in conjunction with HTTP/2 in gRPC, a remote procedure call (RPC) system developed by Google.

Working principles

The data structure is defined in a .proto file, which is then compiled to generate a code to serialize and deserialize data according to this structure.

.proto files are less descriptive than XSDs are for XML messages. A few examples: elements can only have a multiplicity of one or unbounded, fewer data types are supported, referential integrity (key/keyrefs in XSD) cannot be enforced.

Provided the .proto file can be compiled, any language can be used: Protocol Buffers offer an interoperable way of transmitting structured data. Most common programming languages are officially supported (Java, C++, Python, C#, Go, ...) or have third-party implementations.

Applicability to NDC & ONE Order

Protocol Buffers have not yet been tested with NDC messages by IATA.

They could offer a good alternative to XML for the transmission of NDC messages in cases where efficiency is critical. However, because they are not human-readable, their implementation can pose some additional difficulty. Besides, they cannot be used to validate the content of messages against the IATA standards, unlike XML messages.

One challenge is to generate .proto files from the XML schemas. A possible solution is xsd2thrift, a tool that can generate proto (and thrift) files from XSDs.

Key references