26. November 2008

Simple Remote Procedure Call - Array Response

SRPC-ArrayResponse is an extension to SRPC. SRPC-ArrayResponse carries an array of key/value lists as response.

Multiple key/value lists could be encoded as SRPC values with an appropriate escaping and encoding for each list. But SRPC-ArrayResponse presents a standardized way to represent an array of key/value lists instead of the usual one dimensional list.

The normal SRPC response looks like:

  1. a=b
  2. c=d

The ArrayResponse allows for multiple values of similar keys:

  1. 0:a=b
  2. 0:c=d
  3. 1:a=b1
  4. 1:c=d1
  5. 2:a=b2
  6. 2:c=d2

The ArrayResponse allows for multiple values of similar keys:

  1. Status=1
  2. 0:Filename=sp.gif
  3. 0:Data/Encoding=base64
  4. 0:Data/Type=image/gif
  6. 1:Filename=sp2.gif
  7. 1:Data/Encoding=base64
  8. 1:Data/Type=image/gif

The extension looks very similar to SRPC-Batch. The difference is that SRPC-Batch transfers multiple requests and multiple responses in a single transaction whereas SRPC-ArrayResponse has only one request and an item list in the response.

Rationale: the decoder can be shared for both cases. It is always clear how to interpret the array, because you know, if you expect an array response or multiple responses.

Kommentar veröffentlichen