ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Parsers in Plugin node

Post new topic  Reply to topic
 Parsers in Plugin node « View previous topic :: View next topic » 
Author Message
elvis_gn
PostPosted: Wed Jul 19, 2006 11:22 pm    Post subject: Parsers in Plugin node Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi guys,

I'm working on a plugin node and trying to parse an incoming message using this code

Code:
outRoot.createElementAsLastChildFromBitstream(lineContent.getBytes(), "MRM",messageType,messageSet,messageFormat,0,1208,0);


Everything seemed fine....my message was beautifully getting parsed against a message definition which had delimiters as ';' and then I found this

Say I have a message A;B;C;D where A and D are mandatory.

If I send data as 1;2;3;4 the output is
A=1
B=2
C=3
D=4

If I send data as 1;23;4 the output is
A=1
B=23
C=4

If I send data as 1;2;3;5(i've put an enumeration limitation on D to be 4 only) the output is
A=1
B=2
C=3
D=5

Now my doubt is...is it not possible to activate validation on the parser....?
The documentation of the APIs says
Quote:
public MbElement createElementAsLastChildFromBitstream(byte[] bitstream,
String parserName,
String messageType,
String messageSet,
String messageFormat,
int encoding,
int ccsid,
int options)
throws MbException

Parameters:
options - Ignored. This is a place holder for future enhancements.

So does this mean, i can't achieve what I want ?

Btw, yes I know the MRM is not a defined parser class like MbXML or MbBLOB...but even they dont seem to work.

Regards.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Jul 20, 2006 1:10 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hi elvis,

Good problem description - thanks for that. I've got good news and bad news for you

Good news: You can do this with data patterns. Let me know if you need further help.

Bad news:
First two scenarios are exactly what anybody would expect. 1;2;3;5 is also easily explained. The TDS parser will not take enumerations into account when parsing. It simply chops up the bitstream according to the markup ( delimiters, tags, group indicators, group terminators etc) which you have defined.
Now, when you say
Quote:
is it not possible to activate validation on the parser
I presume you are wanting the TDS parser to work out that D is not allowed to be '5', and so assign the '5' to E instead. MRM parsers do not work like that. Validation is applied to the message tree after the parse has occurred, so enumerations cannot influence parsing decisions.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jul 20, 2006 1:40 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi kimbert,

Thanks for the reply.

kimbert wrote:
Good news: You can do this with data patterns. Let me know if you need further help.

Did you mean I can take care of the second condition(1;23;4) using data patters...How will data patters help here...I would like some help with that...
I would want the parser to fail like it does in the Input/RCD nodes when it encounters a field lesser(or even more) in the data.

kimbert wrote:
I presume you are wanting the TDS parser to work out that D is not allowed to be '5', and so assign the '5' to E instead. MRM parsers do not work like that. Validation is applied to the message tree after the parse has occurred, so enumerations cannot influence parsing decisions.

You presume nearly correctly...but I don't mind '5' to be assigned to D(i'm not expecting it to realize the enumeration and assign to another element)...only that the enumeration is never triggered after the parse, and the data is being successfully outputted...I would have expected it to throw an parser exception.

So when you say that enumerations do not influence parsing, how does the MQInput, RCD etc nodes validate them ? Does it finish parse and then again go through the message definition looking for any enumerated fields and test ?
How will I be able to achieve this through Java.... can't find any API for validation...Will FINALIZE_VALIDATE on the MbMessage, or in the above code help ?

Thanks again.

Regards.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu Jul 20, 2006 6:47 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Did you mean I can take care of the second condition(1;23;4) using data patters
No - I meant that you could cause the '5' to be assigned to 'E' using data patterns. But we don't want to do that anyway

Quote:
I would want the parser to fail like it does in the Input/RCD nodes when it encounters a field lesser(or even more) in the data.
Good - that's an easy one. Just put the appropriate Value Constraints on the simple type of each element, and enable validation.

Quote:
Does it finish parse and then again go through the message definition looking for any enumerated fields and test ?
No - if the validation is being performed while parsing, each field is validated after it has been parsed. So the enumerations/lengths still cannot affect the parsing.
Quote:
How will I be able to achieve this through Java
I've never done this, but I would expect that you enable validation via the Options parameter in the same way as when you use CREATE LASTCHILD..PARSE with an OPTIONS clause. Check out the docs for CREATE statement for more details. I think there are a few posts on this subject as well.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Thu Jul 20, 2006 10:56 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi kimbert,

kimbert wrote:
Just put the appropriate Value Constraints on the simple type of each element, and enable validation.

I have done that, if I run the message through a RCD node, it throws the validation errors...
I observed that, even in the RCD, when i switched the validation off, the parsing was similar to what my above code did(the incorrect parsing was sent to output)...When i switched the validation on, it threw the exception.

kimbert wrote:
you enable validation via the Options parameter in the same way as when you use CREATE LASTCHILD..PARSE with an OPTIONS clause. Check out the docs for CREATE statement for more details. I think there are a few posts on this subject as well.

This is what does not seem possible from Java...I did find the OPTIONS keyword in ESQL, but Java will not recognize that(i'm supposed to pass an integer)....and from the API documentation(which i pasted first) I think they are yet to provide validation capability through the API...

Are there any Hursley guys here who work on the MB Input/RCD node development ? Do u have any contacts kimbert ?

Thanks a lot for your help...even if it dosen't work, it's been a good learning curve.

Regards.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Fri Jul 28, 2006 4:24 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I followed this up internally. Validation is not yet supported via the C and Java plug-in APIs because up to now there has been no customer requirement. Not the answer we wanted, but at least we know why it didn't work
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Fri Jul 28, 2006 5:19 am    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi kimbert,
kimbert wrote:
I followed this up internally. Validation is not yet supported via the C and Java plug-in APIs because up to now there has been no customer requirement. Not the answer we wanted, but at least we know why it didn't work

Thanks a lot !!

That saves me a lot of trouble of having to worry if I was doing something wrong...

Btw....can we expect it to get supported sometime soon ?

Regards.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Parsers in Plugin node
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.