ML message transmission and processing are at the foundation of the web service programming model. To effectively improve web service performance, you need to reduce the overhead associated with parsing, serializing, and transmitting XML-based data. Fast Infoset is an open, standards-based solution for doing just that. It specifies several techniques for minimizing the size of XML encodings and maximizing the speed of creating and processing those encodings. Using these techniques, you can tune Fast Infoset encoding according to your specific domain requirements, whether that means favoring compression over processing performance or requiring efficient compression but not at the expense of processing performance.
In general, Fast Infoset documents are smaller and therefore faster to process than corresponding XML representations. As such, they can be very useful when the size and processing time of XML documents are a concern. For an example, the W3C's XML Binary Characterization Working Group has identified two such use cases:
- Web services for small devices that have bandwidth constraints
- Web services within an enterprise that has high throughput requirements
This article introduces Fast Infoset, demonstrates it in an example based on the reference implementation of JAX-WS, and presents some empirical data comparing the effects of Fast Infoset and MTOM/XOP (another technology for optimizing XML data transmission and processing) on web service performance.
XML Infoset and Fast Infoset
An XML infoset is an abstract model of the information stored in an XML document. The XML Information Set (Infoset) is a W3C specification that specifies the result of parsing an XML document, called an XML infoset, and identifies various Infoset components, called information items and properties. More and more technologies, such as SOAP 1.2 and MTOM/XOP, are defined in terms of the XML Infoset, because most common XML use cases are really concerned with the information stored within an XML document rather than its presentation with a specific encoding.
The Fast Infoset specification provides a representation of an instance of infoset using ASN.1 binary encodings. It can serve as an alternative to W3C's Infoset syntax. Fast Infoset documents retain the hierarchical structure described by the corresponding XML infoset. Depending on which features you select, a Fast Infoset document can be self-contained or not. Self-contained Fast Infoset documents can be converted to and from traditional XML documents without loss of information, at least with respect to the information items and properties defined in the XML Information Set. You therefore can consider these representations as equivalent to XML documents for the corresponding XML infosets.
To provide you a concrete example of Fast Infoset document, the source code download for this article contains a SOAP request XML document (lookup_soap_request.xml), the corresponding Fast Infoset document (lookup_soap_request.fi), and the octal dump of the Fast Infoset document (lookup_soap_request.fi.o). You can generate the Fast Infoset document from the XML document with the free tool FI Coverter from Noemax and generate the octal dump with Hod from the Fast Infoset document. You then can view the Fast Infoset document as XML with another free Noemax tool, FI Viewer, to verify that no information was lost during the conversion.