About this task
In the
Graphical
Data Mapping editor, when you define your message data
with user-defined elements, you must comply with the following rules:
- The Graphical
Data Mapping editor sets the cardinality for elements
that are defined at the xsd:any level based on the internal model
of the xsd:any.
- You can configure the cardinality of user-defined elements in the
Properties page of the element.
- You cannot set the cardinality of elements that are defined at the
xsd:any level because their value is defined by the cardinality
set in the message model that provided the xsd:any. Typically,
models define the xsd:any cardinality as Minimum
occurrence = 0 and Maximum
occurrence = unbounded so that user-defined
elements defined at thexsd:any level can optionally exist, and
optionally repeat. The predefined JSON and SOAP message models use this approach.
- You can change the cardinality of a user-defined element of type
<Anonymous> that is not defined at the
xsd:any level.
- You can change the cardinality of any child user-defined element that describes a
user-defined element of type <Anonymous>.
- If you set the type of a simple user-defined element with an external message model,
you cannot change the cardinality of the element in the Properties
page. The cardinality of this element is set from the schema model that you
reference.
- If you set the type of a complex user-defined element with an external message model,
you cannot change the cardinality of its children in the Property
pages. The cardinality of these elements is set from the schema model that you
reference.
- In a JSON message, the following rules apply for JSON arrays:
- You cannot change the cardinality of a user-defined element of type
JSON array that defines a JSON array in the root of a JSON
array message.
- You cannot change the cardinality of Item in a JSON
array.
- If you change the type of Item to
<Anonymous>, you can change the cardinality of any child
elements, including JSON array elements.
The cardinality represents the number of occurrences of an element. You can define an
element as mandatory, optional, or repeating. You set the cardinality of an element by
configuring the
Minimum occurrence and the
Maximum
occurrence properties.
- An optional element has Minimum occurrence set to
0. An optional element can be omitted from the message.
- A repeating element has Maximum occurrence>
1 to indicate a bounded number of repeats, or
Maximum occurrence=unbounded to indicate
an unlimited number of repeats. A repeating element occurs more than once in the
message, and all the occurrences must appear together without any other elements between
them.
Procedure
In the Properties page of a user-defined element, complete
the following steps to set its cardinality if the element is not defined at the
xsd:any level, and the element is a child of a user-defined
element:
- Check whether the default cardinality of a user-defined element meets your message
model requirements or not.
The
Graphical
Data Mapping editor sets the cardinality of
user-defined elements to
1:1, that is, any user-defined element
must be present exactly once.
- Maximum occurrence = 1
- Minimum occurrence = 1
- Set the cardinality of any user-defined element that you add below the
xsd:any level if your data does not match the default
configuration.
- Set the Minimum occurrence to 0 or
1.
- Set the Maximum occurrence to 0,
1, or unbounded.
Example
When you have a simple or complex user-defined element that is not defined at the
xsd:any level, you can configure the cardinality of the element.
The following figure shows an input SOAP message with a user-defined element named
element2. You create this element by using the Add User-Defined function.
To change the default value of Minimum occurrence, open the
Properties page of the element, and select 0
or 1.
To change the default value of Maximum occurrence, open the
Properties page of the element, and select 0,
1, unbounded, or enter a number as
required.
What to do next
Construct the transforms to map the data you model. For more information, see Choosing a transform to map repeating elements or Specifying a transform (mapping operation).