Work with the binary data inside the HTTP requests and responses


Proprietary HTTP-based protocols may use binary messages to pass data from clients to the server and vice versa. For example, such message can contain a serialized Java object.

The Module for Binary formats lets you work with any type of such messages. Binary bodies of HTTP requests are converted to the hexadecimal representation. You can edit it and insert variables containing hexadecimal code of session-specific binary values.

A special additional function is provided for the processing of binary server responses. It can extract binary values from them by the left and right boundaries and/or by the offset and length. The extracted value can be assigned to a WAPT variable in hexadecimal form or as a string of text.

Download

Parameterization of binary data in action

WAPT can show the content of any binary request body and even generate such requests in the test sessions. If you select the binary POST parameters type in the request properties, the request body will look like this:

Binary Request Body

When the Module for Binary formats is installed, this representation changes and becomes editable:

Editable Binary Representation

You can insert variables right into this hexadecimal code to replace the initially recorded values of session-specific parameters. It will also let you extract values from binary server responses and assign them to variables. You can switch to the binary type on the "Response processing" tab for the response you need to work with.

Binary type: Response tab

In the above example the value we want to extract is "143715664". We use the Binary Search function that extracts data from binary responses by the bounding left and right codes. Hexadecimal representation of our value is "31 34 33 37 31 35 36 36 34". It is surrounded by the "01" and "02" bytes. Here is the specification that we use for our function:

Binary Search Function

The Binary Search function can extract values either in hexadecimal form or as a text string:

Binary Search: HEX

Binary Search: UTF

The hexadecimal option is useful, if you need to insert the result in a binary request, as in our case:

Hexadecimal Option

However if the value is to be used in another text request parameter, one of the encoding options should be used instead:

UTF8 Option