You use the If, Else if, and Else transform to set conditions
that control the flow of the data mapping between SOAP body elements
defined as a specific or a derived type in the input and output message
assembly.
Before you begin
Complete the following steps:
- Cast the input and output message assembly body element any to SaveAddress.
For more information, see Casting the SOAP body into a specific type.
- Cast the Address base type defined in the
input and output message assembly body to the CanadianAddress derived
type, the UKAddress derived type, and the USAddress derived
type. For more information, see Configuring derived types in the SOAP body.
About this task
You use an If, Else if, and Else transform to map multiple
derived address types such as the CanadianAddress to
the base address type Address.
In the
scenario, each address contains a country-specific element:
- In a CanadianAddress, each address includes
the element Province.
- In a UKAddress, each address includes the
element County.
- In a USAddress, each address includes the
element State.
The base address type Address includes
an element named AdditionalInfo. You use this
element to store additional information that does not have a corresponding
element in the base address type.
Procedure
Complete the following steps to map a derived type to
a base type by using an If, Else if, and Else transform in the scenario:
- Create and configure the If condition
of the If, Else if, and Else transform. For more information, see Configuring the If condition in an If, Else if, and Else transform.
- Optional: Create and configure the Else
If condition of the If, Else if, and Else transform. For
more information, see Configuring the Else If condition in an If, Else if, and Else transform.
- Create and configure the Else condition
of the If, Else if, and Else transform. For more information, see Configuring the Else condition in an If, Else if, and Else transform.
- Optional: Change the order in which the conditions
you have defined are evaluated by the mapping engine. For more information,
see Changing the order of the conditions in an If, Else if, and Else transform.
- For each condition defined in the If, Else if, and Else
transform, configure the nested map associated with the condition.
Results
You now have a message map that transforms address data,
based on the country of the address. The message map contains a nested
map that uses the If, Else if, and Else transform that you defined.
The
following figure shows the message map after you complete the previous
steps:
What to do next
You have now completed all steps necessary to transform
the sample SOAP message by using a message map that uses an If, Else
if, and Else transform.