Author |
Message
|
Armin |
Posted: Mon Oct 15, 2001 7:50 am Post subject: |
|
|
Novice
Joined: 24 Jul 2001 Posts: 15 Location: Germany
|
I would like to save the comlete content of an XML Message in the OutputDestinationList of a compute node. Saving the message to OutputRoot.XML works ok with this command:
SET "OutputRoot"."XML"."ERROR".(XML.tag)IN_MSG = InputRoot.XML;
But if I try to do the same with
SET "OutputDestinationList"."XML"."ERROR".(XML.tag)IN_MSG = InputRoot.XML;
no deep copy of all elements is done. I´m sure there must be a way. Any ideas?
Armin
|
|
Back to top |
|
 |
Outdesign |
Posted: Tue Oct 16, 2001 6:40 am Post subject: |
|
|
Apprentice
Joined: 16 Sep 2001 Posts: 38 Location: Hampshire, UK
|
Armin,
I can see one flaw in your logic ...
SET OutputRoot.XML.ERROR = ...
Associates the XML parser with the output message and associated syntax element tree
SET OutputDestinationList.XML.ERROR = ...
The DestinationList is only a syntax element tree and does not have an associated parser.
Hence, the XML parser is *NOT* associated with the output message being built.
This is probably why a deep copy of the elements is not performed.
I have not investigated this much and have not found any nice quick solutions
But, here are two options :
(1)
Use a temporary XML structure within the message body.
SET OutputRoot.XML.Temp = InputRoot.XML;
NB! You must remove this temporary structure before writing the message out via
a MQOutput node or you will get a BIP exception as you will have multiple root
elements in your output XML message.
(2)
Use the BITSTREAM function, ie
SET OutputDestinationList.ERROR = BITSTREAM(InputBody);
but this will give you the bitstream of the message and not the character representation
which I suspect is not what you want.
[ This Message was edited by: Outdesign on 2001-10-16 07:41 ] |
|
Back to top |
|
 |
Tibor |
Posted: Tue Oct 16, 2001 1:31 pm Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Outdesign wrote:
...
Use a temporary XML structure within the message body.
SET OutputRoot.XML.Temp = InputRoot.XML;
...
Just for addition, you can make a tree-copy into RFH2, if using it.
SET OutputRoot.MQRFH2.Temp = InputRoot.XML;
|
|
Back to top |
|
 |
wolstek |
Posted: Mon Oct 22, 2001 5:35 am Post subject: |
|
|
Acolyte
Joined: 25 Jun 2001 Posts: 52 Location: Bristol, UK
|
The following has always worked for me
SET OutputDestinationList.WorkArea.XML = InputRoot.XML;
Where input message
HelloAgain
Resulted in
DestinationList.WorkArea.XML.Data.tag1.tag2 = 'Hello'
DestinationList.WorkArea.XML.Data.tag3 = 'Again'
|
|
Back to top |
|
 |
Outdesign |
Posted: Mon Oct 22, 2001 7:24 am Post subject: |
|
|
Apprentice
Joined: 16 Sep 2001 Posts: 38 Location: Hampshire, UK
|
Wolstek,
You need to select the "disable HTML on this post" option so that we can see your XML message
However, the method you have suggested is flawed.
If your message contains attributes, this will not work.
|
|
Back to top |
|
 |
Armin |
Posted: Mon Oct 22, 2001 10:39 pm Post subject: |
|
|
Novice
Joined: 24 Jul 2001 Posts: 15 Location: Germany
|
thanks to all your solutions,
but now I have another related problem. I have to save the contents of the original XML Message not in a tree structure but in one Variable, e.g.
The contents of DestinationList.ORGMSG should be for example: "<START>blabla<MORE>zuzuzu</MORE>...</START>
I have thought about reading the message as Blob appending x'00' and resetting it to mrm (with only one nullterminated String as Message). After that I will switch back zu XML. I think this is a solution. But I dont't like this approach. It is like programning in stoneage(btw. I often think about this when working with the Integrator, it simply takes too much time for doing very easy jobs, compared to e.g C++ and errorhandling is a nightmare).
I await your brilliant, more up to date ideas <g>
Armin |
|
Back to top |
|
 |
Tibor |
Posted: Tue Oct 23, 2001 12:30 am Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Quote: |
On 2001-10-22 23:39, Armin wrote:
but now I have another related problem. I have to save the contents of the original XML Message not in a tree structure but in one Variable, e.g.
...
I have thought about reading the message as Blob appending x'00' and resetting it to mrm (with only one nullterminated String as Message). After that I will switch back zu XML. I think this is a solution...
|
I don't understand why you want to switch your XML into MRM through BLOB. If you have to save into Database just use BITSTREAM() function. It will present values as BLOB (CHAR, VARCHAR, etc. ) in your database.
Later you can get into Root.BLOB.BLOB and "convert" into XML with ResetContentDescriptor node.
|
|
Back to top |
|
 |
Armin |
Posted: Wed Oct 24, 2001 11:00 am Post subject: |
|
|
Novice
Joined: 24 Jul 2001 Posts: 15 Location: Germany
|
Well, I try to explain.
Input to the flow is XML. Output is SAP IDOC format.
The customer wishes that part of the original XML Message ist stored in some textfields of the IDOC (don't ask me why, maybe for control purposes). I cannot use BITSTREAM because it will give me the hex representation of the XML Message.
e.g if I write:
SET OutputDestinationList.XML.IN_MSG = BITSTREAM (InputBody);
I will get something like
(0x1000000)XML = (
(0x3000000)IN_MSG = X'3c3f786d6c2076657273696f6e3d22312e302220656
......
Not excactly what I want. My first idea was to convert the whole message after the Input to one big String, save it in the DestinationList, Reset the message back to XML and do all subsequent processing.
After all there should be a more elegant solution.
Armin |
|
Back to top |
|
 |
Tibor |
Posted: Wed Oct 24, 2001 12:38 pm Post subject: |
|
|
 Grand Master
Joined: 20 May 2001 Posts: 1033 Location: Hungary
|
Quote: |
On 2001-10-24 12:00, Armin wrote:
...
e.g if I write:
SET OutputDestinationList.XML.IN_MSG = BITSTREAM (InputBody);
I will get something like
(0x1000000)XML = (
(0x3000000)IN_MSG = X'3c3f786d6c2076657273696f6e3d22312e302220656
......
|
You get this bytestream, but IDoc will contents the original XML message as a String. I think this is the perfect way to duplicate a message )...
Other way: If you have a 'flat' structure, you can walk thru the fields with ESQL anonymous field name solution.
set i = 1;
while i <= cardinality(InputBody)
set ... = InputBody.*[i];
set i = i + 1;
end while;
If you don't need all fields, use FIELDNAME() function.
|
|
Back to top |
|
 |
|