Web Services changes
There are changes in support of web services in Genero 6.00.
REST functions must include a RETURNS() clause
Starting from FGLGWS 6.00.01, all REST functions must declare a RETURNS()
clause, even when the function does not return a value. This enforces consistent function signatures
and prevents ambiguous web service definitions.
Action needed:
- You must add a
RETURNS()clause to every REST function declaration. -
Update your existing REST functions to include a
RETURNS()declaration — either an explicit return type or an emptyRETURNS().
Omitting the RETURNS clause will raise error -9158
For example:
FUNCTION notifyUser(userId INTEGER)
ATTRIBUTE(WSPost)
# ...
END FUNCTIONBefore (returns
data):FUNCTION notifyUser(userId INTEGER)
ATTRIBUTE(WSPost)
# ...
RETURN "data"
END FUNCTIONRETURNS() must be
added):FUNCTION notifyUser(userId INTEGER)
ATTRIBUTE(WSPost)
# The web service function 'notifyUser' requires a RETURNS() clause.
# See error number -9158.
END FUNCTIONNow (returns data — explicit
RETURNS(return-type) must be
added):FUNCTION notifyUser(userId INTEGER)
ATTRIBUTE(WSPost)
# The web service function 'notifyUser' requires a RETURNS() clause.
# See error number -9158.
RETURN "data"
END FUNCTIONFor more information about using RETURN clauses in RESTful
functions, go to Return value attributesJSONEnum: separator changed from pipe to comma
Starting from FGLGWS 6.00.01, the JSONEnum attribute uses commas instead
of pipes to separate values in its list (for example,
"pending","approved","rejected"). Update declarations that use the old pipe format
to the new comma-separated format to avoid validation errors.
An invalid separator will raise error -9159
Example:
Before:
TYPE ok_string STRING ATTRIBUTE(JSONEnum = `"pending"|"approved"|"rejected"`)
Now:
TYPE ok_string STRING ATTRIBUTE(JSONEnum = `"pending","approved","rejected"`)
For more details, go to JSONEnum
Implicit type conversions in json.Serializer have been removed
Starting from FGLGWS 6.00.00, implicit type conversions in json.Serializer have been removed.
For example, previously you could deserialize a JSON string like "true" to a FGL
BOOLEAN (1), or "123" to a FGL
INTEGER (123).
Now, these assignments will result in errors unless explicitly authorized.
-
If your application relied on automatic type conversions during JSON serialization/deserialization with
json.Serializer, you must now handle these conversions explicitly or useutil.jsonif you require the old behavior. -
The
allowImplicitConversionsetting does not restore the previous implicit conversion behavior injson.Serializer.
Ensure that JSON payloads sent to your 4GL applications use the correct types, as mismatches will now result in errors rather than silent conversions.
For more details, go to Primitive type serialization.
Change in allowImplicitConversion behavior
The handling of implicit conversions for BDL types has also changed. Previously, primitive types
were always allowed to convert implicitly, regardless of the setting. Now, implicit conversions for all
BDL types, including primitive types, are controlled by this option. If it is not set to
allowImplicitConversion1, implicit conversions are no longer permitted.
For more details about the json.Serializer
allowImplicitConversion option, go to allowImplicitConversion.
Changes in earlier versions
Make sure to check the upgrade notes of earlier versions, to not miss changes introduced in maintenance releases. For more details, see Web services changes in BDL 5.01.
- Stricter handling for nulls in serialization of primitive types, objects, and arrays introduced in FGLGWS 5.01.00.
- json.Serializer.getLastErrorDescription method to provide a
more complete message than
sqlca.sqlerrmfor a generated serialization error message introduced in FGLGWS 5.01.01. - Register web services and resources from a package feature introduced in FGLGWS 5.01.02.
- New json.Serializer option for handling implicit conversion,
allowImplicitConversion, introduced in FGLGWS 5.01.03. - Support for Online Certificate Status Protocol (OCSP) was discontinued for FGLGWS versions 3.21.02, 4.01.07, and 5.01.03.