|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
TDS To XML Conversion Strategy |
« View previous topic :: View next topic » |
Author |
Message
|
shadowrunner52 |
Posted: Tue Sep 25, 2007 10:30 am Post subject: TDS To XML Conversion Strategy |
|
|
Novice
Joined: 07 Sep 2007 Posts: 10
|
My incoming message is a tagged, delimited message, wrapped in XML, that I am converting to a pure XML output. However, it is not as simple as that. For the TDS protion of the incoming message the tags can either be numeric (1,2,3,4), or alpha (NAM,DOB,HGT,WGT) and the tag-data seperator can be either a colon ':' or a semi-colon ';'. Any combination of these is acceptable so a message could look like this:
1:smith/john//.DOB;19701010. or NAM:smith/john//.2;19701010.
Fortunately a period '.' is always used as the element seperator. Also, some of the elements themselves need to be parsed. For example, name (1 or NAM) is sent at 'last/first/middle/suffix' so I need to parse that into lastName, firstName, etc. And finally, in the XML output, the elements need to be there even if they are empty.
I have come up with a solution but as I don't consider myself anywhere near a Broker expert I would like some feedback as to whether there is a better way to do this. Here is my solution.
MESSAGE FLOW
1. The message goes into a compute node where I set the MessageSet, MessageType, and MessageFormat of OutputRoot. Then I copy the TDS portion of the message to OutputRoot, replacing all ';' with ':'. OutputRoot is then propagated to 'out1'. The original message is propagated to 'out'.
2. The message from 'out1' goes to a ResetContentDecriptor node. There I reset the message type and message format.
2. The message goes into a compute node where I create all of the required fields in the OutputRoot and then copy the values from the InputRoot. This is the only way I found to make sure the nodes are there in the XML output even if there is no data in the TDS input.
3. Next comes the Mapping node that maps the 'text' message values to my XML message. This result gets put into an MQOutput node that puts the message in a temporary queue.
4. The message from 'out' in step 1 goes to an MQGet node that gets the output from step 3 and merges it with the original XML from the input message.
MESSAGE SET
My TDS message definition contains duplicate elements with different Tag definitions. For example, there are two 'name' elements. One has the TDS1 Tag defined as '1' and the other as 'NAM'. I also have various Types defined for elements such as 'name' that need to be parsed further.
As I said, this IS working. I'm just wondering if there is a better/more efficient way to do this. Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Sep 26, 2007 12:40 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I have come up with a solution |
You already have my respect! Your message style is not at all easy to model
Quote: |
would like some feedback as to whether there is a better way to do this. |
If it really is working ( and I advise you to do some careful testing ) then I would stick with what you have. If you really get stuck, Use Data Pattern might get you out of a hole. |
|
Back to top |
|
 |
shadowrunner52 |
Posted: Wed Sep 26, 2007 4:10 am Post subject: |
|
|
Novice
Joined: 07 Sep 2007 Posts: 10
|
Thanks Kimbert. I tried using data patterns but couldn't get it to work very well. Probably just my inexperience but I'll play around with it some more. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|