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 » MRM vs XMLNSC Validation problem [solved]

Post new topic  Reply to topic
 MRM vs XMLNSC Validation problem [solved] « View previous topic :: View next topic » 
Author Message
Il_Ciclone
PostPosted: Wed Mar 10, 2010 6:18 am    Post subject: MRM vs XMLNSC Validation problem [solved] Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

Hi,

I´m currently working on a transformation from CopyText -> XML
and want to validate the outbound XML message, but can not get the validation to work with the XMLNSC parser. However with the MRM parser validation works.

I have searched the forum and read the infocenter doc on validation still not been able to solve the problem.

With the MRM i set the output templete as:

Code:
message.getRootElement().evaluateXPath("./?Properties/?MessageDomain[set-value('MRM')]");
         message.getRootElement().evaluateXPath("./?Properties/?MessageSet[set-value('" + messageSetId + "')]");
         message.getRootElement().evaluateXPath("./?Properties/?MessageType[set-value('" + messageType + "')]");
         message.getRootElement().evaluateXPath("./?Properties/?MessageFormat[set-value('" + messageFormat + "')]"); 


And i have an MQOutput node with validation set to "Inherit"
This generates an expected error when have write a bad datetime string in the output message.

However when i switch to the XMLNSC (and make sure that the default MsgSet domain and the parser is XMLNSC)
Code:
message.getRootElement().evaluateXPath("./?Properties/?MessageDomain[set-value('XMLNSC')]");
and same as above...

I get no error, but the output XML contains the badly formated datetime string.

Is is possible to set the message template in code then specify validation with the XMLNSC? If so, please give me a hint how to.

I´m using WMBT 6.1.0.5

Thanks in advance for any help.


Last edited by Il_Ciclone on Fri Mar 19, 2010 2:35 am; edited 1 time in total
Back to top
View user's profile Send private message
Gaya3
PostPosted: Wed Mar 10, 2010 6:24 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

did you make use of "Validate" node and tried
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Wed Mar 10, 2010 6:37 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

Gaya3 wrote:
did you make use of "Validate" node and tried


Hi,

I have not because from a maintenance perspective i want to make an aboulute minimum of changes that deviates from our general implementation.

And as i understand it, validation can be done in a number of nodes
(as specified in http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/index.jsp?topic=/com.ibm.etools.mft.doc/ac00400_.htm)
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 10, 2010 7:51 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
want to validate the outbound XML message, but can not get the validation to work with the XMLNSC parser. However with the MRM parser validation works.
XMLNSC validation is almost 100% accurate according to the rules in the W3C XML Schema standard. I suspect that XMLNSC is receiving a valid document for some reason, or else it is not attempting to validate the output document.
Quote:
I get no error, but the output XML contains the badly formated datetime string.
Maybe the XMLNSC parser is not actually validating the message at all?
Quote:
Is is possible to set the message template in code then specify validation with the XMLNSC?
Yes - you can set the message domain, set, type and format in your flow. That's a standard scenario.
Quote:
If so, please give me a hint how to.
I suspect that you are already doing it correctly. If you're not sure whether the properties have been set correctly, use the debugger to inspect the message tree, or insert a Trace node.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 10, 2010 7:53 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
did you make use of "Validate" node and tried
That's not a very helpful question. In case your comment confuses anybody, validation can be performed on the input, output, RCD, MQGet and many other nodes. The Validate node is intended for mid-flow validation, and it is not required very often because of the wide range of other nodes that support validation.
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Wed Mar 10, 2010 8:09 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

kimbert wrote:
I suspect that you are already doing it correctly. If you're not sure whether the properties have been set correctly, use the debugger to inspect the message tree, or insert a Trace node.


Thanks for your reply. I have verified with the debugger that the properties are indeed set.

I am attaching the error i get when i validate with the MRM

Code:

Error casting character string ''2000-01-01AAAA00:00:00'' to a TIMESTAMP. State = ''-1'' ''S22007'' '0' ''   

The character string must have a the form 'TIMESTAMP 'yyyy-mm-dd hh:mm:ss[.f+]'', or 'yyyy-mm-dd hh:mm:ss[.f+]' to be valid for casting to a timestamp.   

Ensure that the string represents a valid time value. 


I have a hard time believeing that this would pass XMLNSC validation, so as you have already suggested, there is probably no validation done at all.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Mar 10, 2010 8:50 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Have you tried setting Validation to 'Content and Value' on the output node?
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Thu Mar 11, 2010 1:53 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

kimbert wrote:
Have you tried setting Validation to 'Content and Value' on the output node?


I tried it with the MRM and noticed a "funny" thing. It looks like i was fooled in to believing that validation actually worked in the MRM.

The flow is basically like this:
Code:
MqInput -> JCN1 -> JCN2 -> MqOutput

Where i set the message template in the JCN1 and some other stuff like the output queue name in JCN2.

When i added Content and Value validation on JCN2 nothing happened.
So i removed the "Inherit" validation from the MqOutput and still got the same error with the MRM.

In the debugger it looks like the error is thrown by the MRM (in the MqOutout) as it is trying to assemble the message and not by the (non-functioning) pre-validation in the JCN1, or even by the validation in the MqOutput.

Below is the more detailed error message which is thrown by the MRM when validation is turned off:

Code:
<Exception>
  <RecoverableException>
   <File>F:\build\S610_P\src\DataFlowEngine\ImbMqOutputNode.cpp</File>
   <Line>910</Line>
   <Function>ImbMqOutputNode::evaluate</Function>
   <Type>ComIbmMQOutputNode</Type>
   <Name>EComFromVipsCommonFlowsOut/EComFromVipsCommon#FCMComposite_1_13.Send_Msg#FCMComposite_1_2</Name>
   <Label>EComFromVipsCommonFlowsOut.EComFromVipsCommon.Send Msg</Label>
   <Catalog>BIPv610</Catalog>
   <Severity>3</Severity>
   <Number>2230</Number>
   <Text>Caught exception and rethrowing</Text>
   <ParserException>
    <File>F:\build\S610_P\src\MTI\MTIforBroker\MtiImbParser2\MtiImbParser.cpp</File>
    <Line>1867</Line>
    <Function>MtiImbParser::refreshBitStreamFromElements - 9 par</Function>
    <Type>ComIbmMQInputNode</Type>
    <Name>EComFromVipsCommonFlowsOut/EComFromVipsCommon#FCMComposite_1_14</Name>
    <Label>EComFromVipsCommonFlowsOut.EComFromVipsCommon.ECOM.SUPER.IN</Label>
    <Catalog>BIPv610</Catalog>
    <Severity>3</Severity>
    <Number>5286</Number>
    <Text>ImbRecoverableException caught from worker when attempting to write out the bitstream.</Text>
    <Insert>
     <Type>5</Type>
     <Text>EComSuperSession</Text>
    </Insert>
    <Insert>
     <Type>2</Type>
     <Text>1</Text>
    </Insert>
    <Insert>
     <Type>5</Type>
     <Text>XML1</Text>
    </Insert>
    <Insert>
     <Type>5</Type>
     <Text>/http://schemas.mycompany.com/format/envelope:VTSEnvelope</Text>
    </Insert>
    <ParserException>
     <File>F:\build\S610_P\src\MTI\MTIforBroker\MtiImbParser2\MtiImbValueValidator.cpp</File>
     <Line>1859</Line>
     <Function>MtiImbValueValidator::basicValidate</Function>
     <Type></Type>
     <Name></Name>
     <Label></Label>
     <Catalog>BIPv610</Catalog>
     <Severity>3</Severity>
     <Number>5164</Number>
     <Text>Exception thrown when casting to the expected logical type</Text>
     <Insert>
      <Type>5</Type>
      <Text>startDate</Text>
     </Insert>
     <Insert>
      <Type>5</Type>
      <Text>DATETIME</Text>
     </Insert>
     <Insert>
      <Type>5</Type>
      <Text>STRING</Text>
     </Insert>
     <Insert>
      <Type>5</Type>
      <Text>2000-01-01AAAA00:00:00</Text>
     </Insert>
     <CastException>
      <File>F:\build\S610_P\src\CommonServices\ImbDateTime.cpp</File>
      <Line>2790</Line>
      <Function>ImbTimeStamp::fromString</Function>
      <Type></Type>
      <Name></Name>
      <Label></Label>
      <Catalog>BIPv610</Catalog>
      <Severity>3</Severity>
      <Number>2461</Number>
      <Text>Invalid timestamp string</Text>
      <Insert>
       <Type>2</Type>
       <Text>-1</Text>
      </Insert>
      <Insert>
       <Type>5</Type>
       <Text>S22007</Text>
      </Insert>
      <Insert>
       <Type>5</Type>
       <Text>2000-01-01AAAA00:00:00</Text>
      </Insert>
     </CastException>
    </ParserException>
   </ParserException>
  </RecoverableException>
 </Exception>


Could it be that the MRM does some validation as it assembles the message that the XMLNSC does not? ie:
Code:
<Function>MtiImbValueValidator::basicValidate</Function>


Ok, back to a concrete question as it seems like there is no validation done in either the MRM och XMLNSC when i specify in on the nodes.

Is it sufficient for validation to take place if i specify the message template and add validation in a node AND also specify the message domain in the Message Set?
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Mar 11, 2010 5:22 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Could it be that the MRM does some validation as it assembles the message that the XMLNSC does not?
No question about it - MRM *does* do some checking of the type when validation is turned off. The MRM parser must use the dateTime template supplied in the message set so it has no choice but to report errors when the conversion fails.
XMLNSC always outputs dates and times in the XML Schema format. It can always do that successfully ( provided that the field in the message tree is a TIMESTAMP or DATE or TIME), so there's no need to throw an error.

Quote:
Ok, back to a concrete question as it seems like there is no validation done in either the MRM och XMLNSC when i specify in on the nodes.
Is it sufficient for validation to take place if i specify the message template and add validation in a node AND also specify the message domain in the Message Set?
Yes, that should be sufficient.
You said that you have set Validation to 'inherit'. Is there any reason why you are not setting it explicitly to 'Content and Value'?

btw, now that you have solved the puzzle of why the MRM domain appeared to be 'validating', I strongly recommend that you switch your flow back to XMLNSC.
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Mon Mar 15, 2010 1:09 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

kimbert wrote:

You said that you have set Validation to 'inherit'. Is there any reason why you are not setting it explicitly to 'Content and Value'?


The validation is set on a node in a standardized subflow that handles the output.
If possible i do not want to mess with the settings in it unless i actually have to in order to activate proper validation, that is.

Thanks for your help so far kimbert, I´ll update this thread if i discover anything thats worth spreading.
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Fri Mar 19, 2010 12:36 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

We did some further investigation, tested the XMLNSC validation samples and found this:

If we set "Content and Value" validation on a JCN, nothing happens (i.e the erroneous message is propagated to the output queue)

If we introduce a RCD node, and set validation to "Content and Value" we get the expected validation error:

Code:
XML schema validation error ''cvc-datatype-valid.1.2: The value "2000-01-01AAAAAAAAAA00:00:00" is not a valid value for the "dateTime"


I don´t know if this matters, but we are extending the JCN like:
Code:
public abstract class MyComputeNode extends MbJavaComputeNode {
//implementation
}

and using the 6.1.0.5 toolkit.

Is this a bug in the JCN, because i would expect the same behaviour for validation in both the JCN and RCD?
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Mar 19, 2010 12:42 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I don´t know if this matters, but we are extending the JCN
Have you tried it with the plain old non-extended JCN? That should answer that question pretty easily.
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Fri Mar 19, 2010 12:59 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

kimbert wrote:
Quote:
I don´t know if this matters, but we are extending the JCN
Have you tried it with the plain old non-extended JCN? That should answer that question pretty easily.


To answer my own question. No it does not matter. Validation did not work when i added a standard JCN and set "Content and Value" validation.

Edit:
The input message domain is MRM and the output is XMLNSC, but the only options specified on the RCD apart from what is default was just "Validation"
Back to top
View user's profile Send private message
kimbert
PostPosted: Fri Mar 19, 2010 1:25 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Replace the standard JCN with a Compute node. If you can prove that the JCN applies the validation settings differently from a Compute node then you have found a defect.
Back to top
View user's profile Send private message
Il_Ciclone
PostPosted: Fri Mar 19, 2010 1:33 am    Post subject: Reply with quote

Novice

Joined: 21 Mar 2007
Posts: 24

kimbert wrote:
Replace the standard JCN with a Compute node. If you can prove that the JCN applies the validation settings differently from a Compute node then you have found a defect.


Nope, the JCN and Compute nodes behave the same. No validation errors.
The RCD and the "Validate" nodes both throw errors.

Still i think that the behaviour is somewhat misleading.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » MRM vs XMLNSC Validation problem [solved]
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.