- Types of variables automatically deserialized
- Types of variables not automatically deserialized
REST Webservices: Automatic deserialization of request
In a REST Webservice, an entry point can have several types: GET, POST, DELETE, ...
The POST entry point receives a parameter that can have different types: Text string, JSON, Binary buffer, ...
From version 23, this parameter is automatically passed to the WLanguage procedure linked to the entry point.
The deserialization is automatically performed according to the type of parameter used and no code is required.
Types of variables automatically deserialized
The deserialization is automatically performed during the following operations :
- Assignment in ANSI strings (and string if the current configuration is ANSI). The received content is directly assigned in the string.
Caution: if the received content is in UTF-8 format, it is directly assigned in UTF-8 in the string.
- Assignment in a buffer. The received content is directly assigned in the buffer.
The result is equivalent to a call to WebserviceParameter associated with the paramBuffer constant.
- Assignment in complex types (variant, array, associative array, structure and class), under conditions:
- If the request is in JSON format, the JSON deserialization is used. The type must be deserialized from JSON.
- If the request is in XML format, the XML deserialization is used. The type must be deserialized from XML.
- If the request is neither in JSON nor in XML format, a specific error is displayed.
Types of variables not automatically deserialized
Some types of variables are not automatically deserialized because this operation may be complex or useless.
The following are not allowed:
- Assigning values to numeric types and the boolean type.
- Assigning values to UNICODE strings (and to strings in general if the current configuration is UNICODE). A specific error is displayed.
- All unmentioned types, especially:
- Untyped parameters.
- Pascal, fixed and ASCIIZ strings.
- DateTime and Duration types.
- Advanced types.
- Enumerations and combinations.
- Requests, automation objects, .NET objects, composite variables, interfaces.
- Variables of type File Description, Item Description, Link Description and Connection Description.
- Variables of type Procedure, Control, Font, Point, Rectangle, etc.
This page is also available for…