Complex data example
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
ABL prototype with a complex parameter accessed as serialized XML
The following examples show how you might manage a complex parameter, or any complex data,
in this case, an OUTPUT parameter as serialized XML. This is a procedure
that maps to a Web service operation, getAddress. Given a social security
number (ssn), the operation returns an address (Address)
as a complex type:
|
This is the schema for a <complexType> element that returns the
address information to the caller. It contains five string data type
elements representing the components of the address:
|
This sample ABL procedure demonstrates how you can manage this complex type in ABL as a DOM
tree. The variable to receive the parameter value, cmAddress, is defined as
a LONGCHAR. After the Web service operation returns a value for
cmAddress, the LOAD( ) method on the x-document handle,
hXDoc, parses and loads the <complexType> element
from cmAddress into the associated x-document object.
Because the schema of the complex type is known, the remaining x-document and x-noderef
handle methods simply retrieve the root node from the "Address" DOM tree,
and pick off the component value (text element) for each of the five component nodes that
comprise the complex type, in order, assigning them to the corresponding fields of a
database record.
This is the ABL example for handling the parameter as a DOM tree:
|