There are times when you have to send an XML message
inside a XML tag of the other message.
There are at least two approaches when doing such a scenario:
– you can change the XML message’s tags into something else
and later on chage it back
– you can also include the XML message inside a CDATA tag
But while doing such transformations you cannot use “Graphical mapping”… is that right?
Not always. We can still use Graphical mapping
but we have to combine it with any other kind of mapping.
XI gives us the possibility to use many mappings with one transformation –
The thing to remember is that only once you can do
The rest of those transformations are
…but this is just great in our case as we want to do the whole mapping inside the first graphical mapping
and then just transform the result a little.
So how can we do it?
– use graphical mapping to trasform our source message
to our target message
(target message contains all tags – in my example it looks exactly the same as the source message)
– then we want to put the WHOLE “name” node inside the “name” tag within CDATA
The first part is easy but how can we do the second one?
We can use Udo ‘s example with .
Do we have to do the transformation inside the interface mapping if we want to use it always
with this particular communication channel?
No we can include our XSLT mapping inside the Communication Channel.
To do this we have to use MessageTransformBean. I’m using a File/FTP channel in my example.
With the help of SAP standard Bean (MessageTransformBean)
we only need to give path to the XSLT mapping
and we don’t have to add it to our Interface mappings. Obviously we have to remember to use the same structure
(some sort of an envelope) of your Target messages so that it will always contain the same root tags so the XSLT mapping
will always work. But it depends on you XSLT mapping too.
We can now remove XSLT mapping from the Interface mapping
and the result looks just like we wanted:
Basically I wanted to show three things:
– the use of several mappings inside an Interface mapping
– how you can change an XML message into a string
– how you can use XSLT mappings inside a communication channel