2.1.1 TCP

When using TCP as the transport, the client and server MUST compose messages by using Direct Internet Message Encapsulation [DIME]. A DIME message consists of one or more DIME records. Each DIME message can be broken into smaller records.<1>

The following table describes the layout of a DIME record.

Field

Description

VERSION
(5 bits)

Specifies the version of the DIME message.

MB (1 bit)

Specifies that this record is the first record of the message.

ME (1 bit)

Specifies that this record is the last record of the message.

CF (1 bit)

Specifies that the contents of the message have been broken into smaller records.

TYPE_T
(4 bits)

Specifies whether the DIME record is the first record of a DIME message.

RESERVED
(4 bits)

The behavior of this field is undefined and MUST be set to 0.<2>

OPTIONS_LENGTH
(16 bits)

Specifies the length (in bytes) of the OPTIONS field, excluding any necessary padding (up to 3 bytes). Padding consists of bytes that are inserted in a data stream to maintain alignment of the protocol requests on natural boundaries.

ID_LENGTH
(16 bits)

Specifies the length (in bytes) of the ID field, excluding any necessary padding
(up to 3 bytes).

TYPE_LENGTH
(16 bits)

Specifies the length (in bytes) of the TYPE field, excluding any necessary padding
(up to 3 bytes).

DATA_LENGTH
(32 bits)

Specifies the length (in bytes) of the DATA field, excluding any necessary padding
(up to 3 bytes).

OPTIONS

Contains any optional information used by a DIME parser.

ID

Contains a Uniform Resource Identifier (URI) for uniquely identifying a DIME payload with any additional padding. The length of this field is specified by ID_LENGTH. For more information, see [RFC2396].

TYPE

Specifies the encoding for the record based on a type reference URI or a MIME media-type. The reference type is specified by TYPE, and the length of this field is specified by TYPE_LENGTH. For more information, see [RFC2396].

DATA

Contains the actual data payload for the record. The format of the data depends on the TYPE specified for the record. The length of this field is specified by DATA_LENGTH.

The VERSION field (5 bits) is used to identify the internal version of DIME parser that is used by both parties. This value MUST be set to 1.

The MB field (1 bit) MUST be set to 1 for every DIME record that is beginning a new DIME message and MUST be set to 0 for all consecutive DIME records.

The ME field (1 bit) MUST be set to 1 for every DIME record that is a last record of every DIME message and MUST be set to 0 for all other DIME records.

The CF field (1 bit) MUST be set to 1 for every chunked DIME record except for the last record. Every chunked sequence is required to be encapsulated entirely within one DIME message and cannot span across multiple DIME messages. Therefore, a first or a middle record MUST NOT have the ME field value set to 1.

The TYPE_T field (4 bits) MUST be set to 1 for every DIME record that is beginning a new DIME message and MUST be set to 0 for all consecutive DIME records.

This protocol allows the optional use of binary XML [MS-BINXML] and compression that the client or server SHOULD<3> apply on the SOAP request or response to reduce network latency. The content types that are supported are described in the following table.

TYPE_LENGTH

TYPE

Description

8

text/xml

Data content is clear text XML.

14

application/sx

Data content is binary XML.

22

application/xml+xpress

Data content is compressed XML.

21

application/sx+xpress

Data content is compressed binary XML.

Because the support for binary XML and compression is optional, the client and server MUST negotiate the content type of the messages for the duration of the connection. This is done using flags in the OPTIONS field. The OPTIONS field consists of 4 bytes of which only the first byte is used. The last three bytes are reserved and MUST be set to zero. The following table describes the bits in the first byte in order from the least significant bit to the most significant bit.

Bit

Description

NEGO

Specifies whether message content type negotiation is complete.

REQ_SX

Specifies whether request from the client is to be binary XML.

REQ_XPRESS

Specifies whether request from the client is to be compressed.

RESP_SX

Specifies whether response from the server is to be binary XML.

RESP_XPRESS

Specifies whether response from the server is to be compressed.

RESERVED

Behavior is undefined. This field MUST be set to 0.

RESERVED

Behavior is undefined. This field MUST be set to 0.

RESERVED

Behavior is undefined. This field MUST be set to 0.