Reference / Attributes to customize XML serialization |
Starting with Genero 2.0, you can add optional attributes to the definition of program variables to be used for XML serialization. These attributes can be used to map a BDL data type used in the input or output message of a Genero Web Service application to a specific XML data type, rather than using the default.
For example, if an XML Schema boolean data type is required for an application, and the corresponding BDL type is a SMALLINT, you can use an attribute to map the BDL SMALLINT variable to the XML boolean.
The following example uses the XSDBoolean attribute to map a BDL SMALLINT variable to an XML Schema boolean type, and assigns an uppercase name as the XMLName attribute:
GLOBALS DEFINE invoice_out RECORD ok SMALLINT ATTRIBUTES(XSDBoolean,XMLName="OK") END RECORD END GLOBALS
If you assign your own XMLName attributes, be sure to respect the conventions when using the RPC Service Style.
See the Tutorial: Writing a GWS Server application for additional information about input and output messages.