This is the fifth stage of the scenario to perform
simple
message enrichment. This topic demonstrates how to develop a message
flow and message model for mapping a complex nested, repeating message. It
also involves developing corresponding instance documents.
- In the COMPLEX message definition, in namespace 'www.complex.net',
create a message called addev3, which has the following structure:
addev3
choice
sstr (xsd:string) local element
intrep (xsd:int) local element, minOcc=2, maxOcc=6
dur (xsd:duration) local element
choice
comp1 local complex element
dat1 (xsd:date) local element
sval (xsd:string) local element
comp2 local complex element
bool1 (xsd:boolean) local element
dat2 (xsd:date) local element
comprep local complex element, minOcc=1, maxOcc=4
int1 (xsd:int) local element
dec1 (xsd:decimal) local element
binel (xsd:hexBinary) local element
lelem local complex element, base type xsd:string
latt (xsd:int) local attribute
lcomp local complex element
head (xsd:string) local element
incomp local complex element
count (xsd:int) local element
comp:gcompel global complex element, minOcc=0, maxOcc=-1
fstr (xsd:string) local element
multel local complex element
in1 (xsd:boolean) local element
in2 (xsd:string) local element
in3 (xsd:float) local element
footer (xsd:string) local element
repstr (xsd:string) local element, minOcc=1, maxOcc=-1
- Create a message flow called addev3, which contains the following
mapping: MQInput> Mapping> MQOutput.
- Open the map and select addev3 as the source and target.
- Map each source element to its corresponding target element:
sstr --- sstr
intrep --- intrep
dur --- dur
dat1 --- dat1
sval --- sval
bool1 --- bool1
dat2 --- dat2
int1 --- int1
dec1 --- dec1
binel --- binel
lelem --- lelem
latt --- latt
head --- head
count --- count
fstr --- fstr
multel --- multel
footer --- footer
repstr --- repstr
- In the Spreadsheet pane, for the first condition, change fn:true()
to fn:exists($source/comp:addev3/sstr).
- For the second condition, change fn:true() to fn:exists($source/comp:addev3/intrep).
- For the third condition, change fn:true() to fn:exists($source/comp:addev3/dur).
- For the first complex choice condition, change fn:true() to fn:exists($source/comp:addev3/comp1).
- For the second complex choice condition, change fn:true() to fn:exists($source/comp:addev3/comp2).
- For the third complex choice condition, change fn:true() to fn:exists($source/comp:addev3/comprep).
- Create the following instance messages, with appropriate RFH2 headers:
<comp:addev3 xmlns:comp="http://www.complex.net">
<sstr>first</sstr>
<comp1>
<dat1>2005-06-24</dat1>
<sval>date value</sval>
</comp1>
<binel><![CDATA[3132333435]]></binel>
<lelem latt="24">twenty four</lelem>
<lcomp>
<head>nesting start</head>
<incomp>
<count>3</count>
<comp:gcompel>
<fstr>first</fstr>
<multel>
<in1>1</in1>
<in2>C</in2>
<in3>2.45E+1</in3>
</multel>
</comp:gcompel>
<comp:gcompel>
<fstr>second</fstr>
<multel>
<in1>1</in1>
<in2>D</in2>
<in3>7.625E+3</in3>
</multel>
</comp:gcompel>
<comp:gcompel>
<fstr>third</fstr>
<multel>
<in1>0</in1>
<in2>C</in2>
<in3>4.9E+0</in3>
</multel>
</comp:gcompel>
</incomp>
<footer>nesting end</footer>
</lcomp>
<repstr>abc</repstr>
<repstr>def</repstr>
<repstr>ghi</repstr>
<repstr>jkl</repstr>
<repstr>mno</repstr>
</comp:addev3>
<comp:addev3 xmlns:comp="http://www.complex.net">
<intrep>45</intrep>
<intrep>12</intrep>
<intrep>920</intrep>
<comp2>
<bool1>1</bool1>
<dat2>2005-06-24</dat2>
</comp2>
<binel><![CDATA[3132333435]]></binel>
<lelem latt="24">twenty four</lelem>
<lcomp>
<head>nesting start</head>
<incomp>
<count>5</count>
<comp:gcompel>
<fstr>first</fstr>
<multel>
<in1>1</in1>
<in2>C</in2>
<in3>2.45E+1</in3>
</multel>
</comp:gcompel>
<comp:gcompel>
<fstr>second</fstr>
<multel>
<in1>1</in1>
<in2>D</in2>
<in3>7.625E+3</in3>
</multel>
</comp:gcompel>
<comp:gcompel>
<fstr>third</fstr>
<multel>
<in1>0</in1>
<in2>C</in2>
<in3>4.9E+0</in3>
</multel>
</comp:gcompel>
<comp:gcompel>
<fstr>fourth</fstr>
<multel>
<in1>1</in1>
<in2>F</in2>
<in3>2.98E+1</in3>
</multel>
</comp:gcompel>
<comp:gcompel>
<fstr>fifth</fstr>
<multel>
<in1>0</in1>
<in2>D</in2>
<in3>8.57E-2</in3>
</multel>
</comp:gcompel>
</incomp>
<footer>nesting end</footer>
</lcomp>
<repstr>abc</repstr>
</comp:addev3>
<comp:addev3 xmlns:comp="http://www.complex.net">
<dur>P2Y2M</dur>
<comp3>
<int1>6</int1>
<dec1>2821.54</dec1>
</comp3>
<comp3>
<int1>41</int1>
<dec1>0.02</dec1>
</comp3>
<binel><![CDATA[3132333435]]></binel>
<lelem latt="24">twenty four</lelem>
<lcomp>
<head>nesting start</head>
<incomp>
<count>0</count>
</incomp>
<footer>nesting end</footer>
</lcomp>
<repstr>abc</repstr>
<repstr>def</repstr>
<repstr>ghi</repstr>
<repstr>jkl</repstr>
<repstr>mno</repstr>
<repstr>pqr</repstr>
<repstr>stu</repstr>
<repstr>vwx</repstr>
</comp:addev3>
Now deploy the message set and message flow.