|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Message Broker Toolkit : message definition query |
« View previous topic :: View next topic » |
Author |
Message
|
sudeepm |
Posted: Thu May 29, 2008 9:29 pm Post subject: Message Broker Toolkit : message definition query |
|
|
Acolyte
Joined: 31 Jan 2008 Posts: 57
|
Hi all,
this is a general query regarding creating message definitions. My input message is of the format :
<Header>
<Line>
<Line>
<Line>
......
<Tralier>
That is,there is only one header,infinite number of line items and then only one trailer. There are no tags for the header or line or trailer. Also,the fields are fixed length.If I define the message definition setting the minOccurs/maxOccurs as 1/-1 for the line element and try to parse a message with 3 line elements using this message definition,what the MB does is it creates 3 line elements and then tries to parse the trailer element considering it as a line element,which seems obvious because there is no way for the MB to identify what the occurrence of line item is.
What i want to know is....is there a way to configure the msg defn to parse the very last line of the message as the trailer,the first line as the header and everything in between as line elements. One way obviously is to add tags for header,line and trailer elements but i wud like to avoid changing my message structure.
so if someone cud suggest sumthing,it wud be grt!! |
|
Back to top |
|
 |
kimbert |
Posted: Fri May 30, 2008 1:19 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
What i want to know is....is there a way to configure the msg defn to parse the very last line of the message as the trailer,the first line as the header and everything in between as line elements |
You need to set Data Element Separation to 'Use Data Pattern' on the outermost complex type. Then set a Data Pattern on Header, Line, Trailer. I cannot advise you on what the data patterns should be, because I haven't seen your data. However, if we assume that the length of the lines is different, then you could do this:
Code: |
Message
Complex Type DataElementSeparation="Use Data Pattern", Composition=Choice, maxOccurs=-1
Header DataPattern=".*{10}\r\n"
Line DataPattern=".*{20}\r\n"
Trailer DataPattern=".*{5}\r\n" |
Note that this will allow any number of Headers, Lines and Trailers in any order. There may be a more complex model which will validate the input more strictly. |
|
Back to top |
|
 |
sudeepm |
Posted: Tue Jun 03, 2008 7:34 pm Post subject: |
|
|
Acolyte
Joined: 31 Jan 2008 Posts: 57
|
kimbert wrote: |
Quote: |
What i want to know is....is there a way to configure the msg defn to parse the very last line of the message as the trailer,the first line as the header and everything in between as line elements |
You need to set Data Element Separation to 'Use Data Pattern' on the outermost complex type. Then set a Data Pattern on Header, Line, Trailer. I cannot advise you on what the data patterns should be, because I haven't seen your data. However, if we assume that the length of the lines is different, then you could do this:
Code: |
Message
Complex Type DataElementSeparation="Use Data Pattern", Composition=Choice, maxOccurs=-1
Header DataPattern=".*{10}\r\n"
Line DataPattern=".*{20}\r\n"
Trailer DataPattern=".*{5}\r\n" |
Note that this will allow any number of Headers, Lines and Trailers in any order. There may be a more complex model which will validate the input more strictly. |
hey buddy...thx a lot....it worked perfect...wasnt aware of the data pattern option... the data pattern that i used was .{10}\r\n and similarly for other elements.
thx a lot again!! |
|
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
|
|
|
|