Author |
Message
|
satya2481 |
Posted: Tue Jan 10, 2012 3:59 am Post subject: MRM XML Parsing Within the Compute Node Decimal Data Check |
|
|
Disciple
Joined: 26 Apr 2007 Posts: 170 Location: Bengaluru
|
Hi All,
I am working on V6.1 Broker with V6.1.0.9 Toolkit. Below is the flow developed.
MQInput Node (BLOB Domain) --> ComputeNode (Parse the message against MRM Domain XML Format) --> MQOutput Node
I am using below ESQL code to parse the message.
Code: |
DECLARE parserOptions INTEGER BITOR(ValidateContentAndValue, ValidateException, ValidateComplete);
CREATE LASTCHILD OF Environment.ParsedMsg AS ParsedMsgRef DOMAIN ('MRM') PARSE(InputRoot.BLOB.BLOB OPTIONS parserOptions SET 'MessageSetName' TYPE 'MessageType' FORMAT 'XML' ENCODING contextRef.MQ.Encoding CCSID contextRef.MQ.CodedCharSetId); |
Incoming message is having a field (Call it as <Amount>)which is declared of type Decimal in the message definition with MinValue = 0.
I want above Parse statement to throw an error/exception when <Amount> = -11.25 (Since value is less than allowed minimum value).
But in my case I am not getting an error/exception. Why ? Am I doing something wrong ?
However if I send <Amount> = 11.2A then above parse statement throws error.
Thank You in advance
Satya |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 10, 2012 5:55 am Post subject: Re: MRM XML Parsing Within the Compute Node Decimal Data Che |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
satya2481 wrote: |
Why ? Am I doing something wrong ? |
Well for starters you're working with an XML document and I don't see the word "XMLNSC" anywhere in your code.
The problem is that the value "11.2A" can't be fitted in a type decimal field, "-11.25" can be so it's a question of what can honour the definition.
Also (and not directly relevant to your problem) why are you parsing in the Compute node rather than the MQInput? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 10, 2012 6:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Vitor is correct - you should not be using MRM XML in a new message flow.
Quote: |
I want above Parse statement to throw an error/exception when <Amount> = -11.25 (Since value is less than allowed minimum value). |
You need to set validation to 'Content and Value'. You may want to set Parse Timing to 'Immediate' as well, if you decide to take Vitor's advice and set the parsing properties on the input node ( and I accept that you may be using the BLOB domain for a good reason, although it would be interesting to know what the reason is ). |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 10, 2012 6:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
kimbert wrote: |
I accept that you may be using the BLOB domain for a good reason, although it would be interesting to know what the reason is |
Likewise here, interested but not the problem directly. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
ruchir123 |
Posted: Tue Jan 10, 2012 10:14 am Post subject: |
|
|
Acolyte
Joined: 04 Jan 2012 Posts: 58
|
Hi Vitor,
As you said we can parse in MQINPUT node too , but doing parsing in MQINPUT node or COMPUTE node create any difference in functionality wise as in both the case we can set validation to 'content and value', so they will fulfill the same thing of parsing the message.
Hi Satya,
Normally PARSE function have this issue if we are giving STRING as input to PARSE function rather than BLOB, so please check with your input BLOB that you are providing to PARSE function. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jan 10, 2012 10:55 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
ruchir123 wrote: |
so they will fulfill the same thing of parsing the message. |
Yes, I know, that's why I asked why the parsing was being done in the Compute node & probably why kimbert asked as well.
ruchir123 wrote: |
Normally PARSE function have this issue if we are giving STRING as input to PARSE function rather than BLOB, so please check with your input BLOB that you are providing to PARSE function. |
How exactly do you suspect the OP is getting the MQInput node to pass a string (or as we call it in WMB a CHARACTER variable) into the code? Given that the posted code segment is clearly referencing InputRoot.BLOB.BLOB which can't possibly by anything other than a BLOB?
Also if the input was that badly configured I wouldn't expect anything to parse, yet the negative decimal value seems to result in a properly formed messge tree (to the dismay of the OP). _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jan 10, 2012 3:27 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
ruchir123: you said:
Quote: |
value is less than allowed minimum value |
According to what? Is there a facet on the simple type that sets a minimum value?
Either way, if you are parsing XML and especially if you are validating it against an xsd then you should certainly be using XMLNSC and not MRM. |
|
Back to top |
|
 |
|