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 XML Validation with PARSE Statement Not validating

Post new topic  Reply to topic Goto page 1, 2  Next
 MRM XML Validation with PARSE Statement Not validating « View previous topic :: View next topic » 
Author Message
satya2481
PostPosted: Tue May 08, 2012 9:55 pm    Post subject: MRM XML Validation with PARSE Statement Not validating Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

Hi All,

I am using WMB V6.1.0.8 and trying to parse request message against MRM XML Message definition. The ESQL Code looks like below.

Code:
DECLARE parserOptions INTEGER BITOR(ValidateContentAndValue, ValidateException);

CREATE LASTCHILD OF ClientData.ParsedMsg AS ParsedMsg DOMAIN ('MRM')
PARSE(BLOBMsg
OPTIONS parserOptions
SET 'MessageSetId'
TYPE 'MsgType'
FORMAT 'XML'
ENCODING InputRoot.MQMD.Encoding
CCSID InputRoot.MQMD.CodedCharSetId);


Message definition is having around 100 fields.

Suppose a new field (Which is not present in the Message definition) is sent in the request message I am expecting above statement to rhrow an error indicating new field is present in the Request message other than the fields defined in the message set. But there are no errors and no Exceptions.

Is this the expected behaviour ? If not how to achieve the requirement of throwing an error if new field is sent in the request message ?

Thank You
Regards
Satya
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Tue May 08, 2012 11:10 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

So what happens when you try it with the extra field?

Have you looked at the OPTIONS available for the CREATE PARSE?

ValidateContentAndValue might just do the job.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue May 08, 2012 11:17 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

You should not be using the MRM parser to parser and/or validate an XML document. Why are you not using XMLNSC?

ValidateImmediate is the option that you need - otherwise the parser will be given the bit stream but will not actually do any parsing until you access one of the child elements of 'ParsedMsg'.
Back to top
View user's profile Send private message
satya2481
PostPosted: Wed May 09, 2012 6:04 am    Post subject: Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

Quote:
Why are you not using XMLNSC?

The code and the message set are existing projects. Requirement is not to use any other domain. Hence using MRM XML as it is.

I have not yet tried ValidateImmediate option.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Wed May 09, 2012 6:17 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

OK - that's a valid reason for using MRM XML. But please don't use it in new message flows.
Back to top
View user's profile Send private message
satya2481
PostPosted: Mon May 14, 2012 12:04 am    Post subject: Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

Anyone see any other option to validate the complete message ?
Or any issues with my approach?
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Mon May 14, 2012 12:21 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Did you try with ValidateImmediate? You don't need to use XMLNSC - ValidateImmediate applies to MRM as well.
Back to top
View user's profile Send private message
satya2481
PostPosted: Wed May 16, 2012 2:51 am    Post subject: Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

Yes, I have tried with below parserOptions.

Code:
DECLARE parserOptions INTEGER BITOR(ValidateContentAndValue, ValidateException, ValidateImmediate)
DECLARE parserOptions INTEGER BITOR(ValidateContentAndValue, ValidateException, ValidateComplete)


In both cases the PARSE statement not throwing any error. It simply passes the values as it is.

I do not want to use Sequence option. Because the fields can come in any order. I just want to validate such a way that if any new field is sent in the input XML Message the PARSE statement has to throw an error indicating <FieldName> is not present in the definition.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Wed May 16, 2012 3:30 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Your next step is to prove that your input XML document does not match the xsd. You can do that in various ways:
- Try it with XMLNSC. If XMLNSC does not throw a validation error then the document is valid, with 99.9% confidence.
- create an XML project in the broker toolkit and import your xsd and XML document
- use a third-party XML editing tool such as XMLSpy

If all else fails, cut down your XSD and XML to the minimum size, and post them here.
Back to top
View user's profile Send private message
satya2481
PostPosted: Wed May 16, 2012 9:34 pm    Post subject: Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

MRM XML Message set is created manually and not from the schema. Schema is not available. However I have created the schema from the message definition and validated the request message in XML Spy and its validating correctly. I mean error is reported if a new field is added in the request message.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Thu May 17, 2012 12:44 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Please post your xsd and example message(s).
Back to top
View user's profile Send private message
deepnair
PostPosted: Thu May 17, 2012 6:58 am    Post subject: Reply with quote

Apprentice

Joined: 07 Feb 2012
Posts: 35

Another way is to check if your coming message is XML (convert BLOB to string and check for XML), if yes then only for validation purpose - parse it as XMLNSC and throw error.

If there is no exception, then convert the blob to MRM and continue your processing.

Thanks,
Deep Nair
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu May 17, 2012 11:55 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

@deepnair: Sounds as if the same effect could be achieved by setting the domain on the input node to 'XMLNSC' and then using an RCD node immediately after the input node.
btw, I don't think the OP has any doubts about whether the data is XML.
Back to top
View user's profile Send private message
deepnair
PostPosted: Thu May 17, 2012 12:48 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Feb 2012
Posts: 35

@Kimbert - Yes you are right, they can do at the input node but I think @satya is planning to reuse an exisitng message set and an exisitng flow that caters to non XML too, so they cannot modify the input node to XMLNSC but handle the XML in compute node via Parser options.

Either way - XMLNSC will be a better fit here...
Back to top
View user's profile Send private message
satya2481
PostPosted: Thu May 17, 2012 9:15 pm    Post subject: Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

Thank you all for your responses.
However I didnt get any response where I can try out few options.

As I earlier told the code is existing code, we are having a framework for parser. So I can not alter the input node domain. I cant add RCD node either. My requirement is to use PARSE statement and use MRM XML Domain only and validate the message.

As of now I am just adding PARSE statment and proceeding. Though it will not validate the incoming message completely.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » MRM XML Validation with PARSE Statement Not validating
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.