Author |
Message
|
jbanoop |
Posted: Wed Nov 09, 2005 9:06 pm Post subject: Compute Node not throwing validation error |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
Hi all,
I have been trying out validating an input XML in the message flow using
the compute node by turning on the validation and trying to parse the
message using the parse() method.
In debug mode while tracing through the code in compute node, behaviour isas expected and an exception is thrown on a parsing error and controlmoves to the failure terminal.
The same code when run without debugging is going to the out terminal of
the compute node.
I am using an MRM modelled message for input.
The code that does the parsing is:
Create LASTCHILD OF OutputRoot.MRM PARSE(InputRoot.BLOB.BLOB,InputRoot.MQMD.Encoding,
InputRoot.MQMD.CodedCharSetId,
'EJ28GMS002001',
'AZ_ABSENCE_ENTL_OUT',
'XML1');
Is there something I could be missing here ?
Regards,
Anoop |
|
Back to top |
|
 |
elvis_gn |
Posted: Wed Nov 09, 2005 11:34 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi jbanoop,
Let me get you right first.....
You are trying to validate the Input XML in the compute node by turning the Validation to Content and value in the compute node ????
Then what about the Validation in the input node ???
It is not possible that you get two differen results on turning ON/OFF the debugger....in both cases it should go to thesame ouput terminal.....
Please be a little bit more elaborate.....
Regards. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Nov 10, 2005 3:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
elvis_gn:
Quote: |
You are trying to validate the Input XML in the compute node by turning the Validation to Content and value in the compute node ???? |
What's wrong with that? this is perfectly standard practice. You can validate the input message using the MQInput node, or you can enable validation on the Compute node. Nothing wrong with either approach.
jbanoop: you need to supply some options in the PARSE clause of the CREATE statement.
Quote: |
Parse clause
|--PARSE--(--BitStreamExpression--+------------------------------+--)--|
| .-<<-----------------------. |
| V | |
'---+-OPTIONS--expression--+-+-'
+-ENCODING--expression-+
+-CCSID--expression----+
+-SET--expression------+
+-TYPE--expression-----+
'-FORMAT--expression---'
|
The option you need is 'ValidateContentAndValue' |
|
Back to top |
|
 |
mgk |
Posted: Thu Nov 10, 2005 4:06 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
I suspect that you may also want the option ValidateImmediate as well. (use the BITOR function to specify both). _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Nov 10, 2005 4:08 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
I'm confused.....Then how do u validate the output message ???
My impression was that the MQInput Node Validation was for the Input Message Validation and the MQCompute Node did the validation of the outgoing Message, so it would in turn be a Output Message Validation.....
Please correct my understanding...??
Regards. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Nov 10, 2005 4:20 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
No, I was confused I thought you were objecting to setting validation options on the Compute node.
jbanoop: if you simply want to validate the input message, just set the validation options on the MQInput node, as elvis_gn suggests. If your requirements are more complicated, you may need to use CREATE...PARSE approach. |
|
Back to top |
|
 |
jbanoop |
Posted: Thu Nov 10, 2005 12:00 pm Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
Hi all,
elvis_gn : My actual requirement is that i read in an XML input from a queue. Now if this XML does not conform to the message I have defined on MRM, I need to write this message to a particular folder.
If I am putting the this on the MQINput node, then the message received on the failure terminal is the partially parsed message structure which is not what I want to write to output.
So I am reading the input in as a blob and trying to parse it into the message within a compute node.
mgk: could you tell me how and where I should be using the BITOR function. paron my ignorance.
Regards,
Anoop[/b] |
|
Back to top |
|
 |
jbanoop |
Posted: Thu Nov 10, 2005 12:37 pm Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
mgk : I am using this following bit of code and when a parse error is encountered it is working fine now. Thanks for the hint
DECLARE options INTEGER BITOR(RootBitStream, ValidateContent,ValidateValue,ValidateImmediate);
CREATE NEXTSIBLING OF OutputRoot.MQMD DOMAIN 'MRM'
PARSE(InputRoot.BLOB.BLOB OPTIONS options ENCODING InputRoot.MQMD.Encoding CCSID InputRoot.MQMD.CodedCharSetId SET 'EJ28GMS002001' TYPE 'AZ_ABSENCE_ENTL_OUT' FORMAT 'XML1');
Now my problem is not quite solved here. When I pass in a well formed XML which has additional tags which are not modelled on my MRM message, it still goes thru to the out terminal. Is there something I should be setting on the message set I have created ?
Regards,
Anoop |
|
Back to top |
|
 |
jbanoop |
Posted: Thu Nov 10, 2005 4:41 pm Post subject: |
|
|
Chevalier
Joined: 17 Sep 2005 Posts: 401 Location: SC
|
I got the problem solved now.
The options that I am setting on the parse clause goes like this:
DECLARE options INTEGER BITOR(ValidateValue, ValidateContent,ValidateException, ValidateComplete, ValidateFullConstraints);
I think that the ValidateException creates the exception if the input does not match the MRM message or even if it is not a well formed XML in my case.
The thing i do not understand is that on the compute node I have already set the validateContent and failure action as Exception. However it appears that I am having to repeat the same code when actually invoking the parse clause.
Thanks a lot for all your tips.
Regards,
Anoop |
|
Back to top |
|
 |
kimbert |
Posted: Fri Nov 11, 2005 3:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
The thing i do not understand is that on the compute node I have already set the validateContent and failure action as Exception. However it appears that I am having to repeat the same code when actually invoking the parse clause. |
This is by design. The Compute node properties control what happens to the message when it gets serialized. (by the way, you may want to switch off the validation properties on your Compute node to avoid double-validation).
Having separate validation controls on the CREATE...PARSE statement allows the same Compute node to parse one message without validation, and then parse another message with validation. It also allows the timing of the validation to be controlled more accurately. |
|
Back to top |
|
 |
|