News
Abstract
Ability to determine whether a field is null in a request or to indicate whether a field should be returned as null in a response.
Content
You are in: IBM i Technology Updates > Welcome to IBM Integrated Web Services for i Technology Updates > Detect null fields
What is it?
Integrated web services (IWS) introduces the ability for web service implementation code (ILE program or service program) to detect whether a field is set to a value in a client request, and to indicate whether a field should be set to null in a client response.
Recall that if you enable Detect length fields when deploying a web service, IWS assumes that a numeric field immediately preceding an array field with the same name as the array field appended with '_LENGTH' is a length field that will be used to indicate the actual number of elements in the array. For example, if an array field identifier is 'myarray', then the number of elements in the array is given by a field preceding 'myarray' with an identifier of 'myarray_LENGTH'.
Similarly, to enable the ability to detect null fields, you must define a character field that precedes the field for which null detection is to be determined with the suffix of '_ISNULL'. If the is-null indicator length is less than 5 characters, the value will be set to '1' if the field is null, and '0' if the field is not null. If the is-null indicator size is greater than 4 characters, the is-null indicator will be set to 'true' if the field is null, and 'false' if the field is not null.
Length fields and is-null fields are called transient fields, which are fields that are not part of the serialization process (not part of the actual request and response payload). Thus, in the Web Administration GUI a change has been made to change Detect length fields to Detect transient fields.
Both a length field and an is-null field may be specified for a field, and the order does not matter as long as the transient fields are specified immediately before the field.
The following is an example of an is-null indicator in RPG code for a field that is a structure:
bufferin_ISNULL char(1);
bufferin likeds(fields );
Notes:
- If you generate a configuration file for a web service, the property 'ws.iws.gen.detectfieldlengths' has been changed to 'ws.iws.gen.detecttransientfields'. If you have the IWS PTF installed, the Qshell scripts understand both properties. However, if you generate a configuration file and try to use it on another system that does not have the IWS PTF, you will have to change the property from 'ws.iws.gen.detecttransientfields' to 'ws.iws.gen.detectfieldlengths'.
Why use it?
The detection of null fields enable the web service implementation code to know which fields are set in client requests and to limit what should be returned in client responses, potentially making the processing of client requests more efficient.
Prior to this update, if a client request passes a field with a null value (or if field is omitted), the web service implementation code is not able to determine that the field is not set since numeric null fields are passed in with value of zero, and character null fields are passed in with field set to blanks.
Availability
The support is enabled in the following PTFs:
V7R5M0 SI85609 (IWS), SI85421 (Web Admin GUI)
V7R4M0 SI85610 (IWS), SI85422 (Web Admin GUI)
V7R3M0 SI85611 (IWS), SI85423 (Web Admin GUI)
[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"HW1A1","label":"IBM Power Systems"},"Component":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]
Was this topic helpful?
Document Information
Modified date:
28 December 2023
UID
ibm17099353