Author |
Message
|
Jain |
Posted: Sun Nov 13, 2011 7:39 pm Post subject: Dynamic validation of messgae according to the Msg Set |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
I am trying to validate given msgs which is wrapped in the another xml.
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<X:R>
<X:nk>(domain-XMLNSC, format-XML1, msgsets details)</X:nk>
<X:D>(input Xml which need to be validate)</X:D>
</X:R> |
And i'm using the code
DECLARE payload BLOB ASBITSTREAM(InputRoot.XMLNSC.X:R.X:D.*[1]
ENCODING 546 CCSID 500 SET mset TYPE mtype FORMAT mformat OPTIONS FolderBitStream);
CREATE LASTCHILD of Environment.Variable.load domain(mdomain) parse(payload ENCODING 546 CCSID 500 SET mset TYPE mtype FORMAT mformat);
But it's validating even in d wrong msg set details. pls let me know where i'm doing wrong. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Nov 13, 2011 9:24 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Well you're putting the payload in the environment (parsed)...
So what are you trying to validate... the environment or the OutputRoot?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Jain |
Posted: Mon Nov 14, 2011 1:22 am Post subject: |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
fjb_saper wrote: |
Well you're putting the payload in the environment (parsed)...
So what are you trying to validate... the environment or the OutputRoot?  |
just for checking logs i was using "Environment.Variable.load " although i's OutputRoot. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 14, 2011 1:36 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I am trying to validate given msgs which is wrapped in the another xml. |
Why are you doing it this way? Where does the input XML come from?
The usual way to do this is to put the meta-data into an RFH2 header. Have you considered that approach? |
|
Back to top |
|
 |
Jain |
Posted: Mon Nov 14, 2011 2:00 am Post subject: |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
kimbert wrote: |
Quote: |
I am trying to validate given msgs which is wrapped in the another xml. |
Why are you doing it this way? Where does the input XML come from?
The usual way to do this is to put the meta-data into an RFH2 header. Have you considered that approach? |
I don't know hw to implement RFH2 header approach. Can u pls help me out to implement the same.
<X >(input Xml which need to be validate)</X > here input XML is being generated msgset -> .xsd > .xml and
<X:nk>(domain-XMLNSC, format-XML1, msgsets details)</X:nk> and here i'm putting the same msgsets details. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 14, 2011 2:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzaw.doc/jm25440_.htm
Read the section 'The <mcd> folder'
Please note that the table contains errors - it should say this:
Code: |
mcd.Msd string <mcd><Msd>parserName</Msd></mcd>
mcd.Set string <mcd><Set>messageSetName</Set></mcd>
mcd.Type string <mcd><Type>globalElementName</Type></mcd>
mcd.Fmt string <mcd><Fmt>physicalFormatName</Fmt></mcd> |
You will be using XMLNSC. so your <mcd> folder will look something like this:
Code: |
<mcd><Msd>XMLNSC</Msd><set>yourMessageSet</set><Type></Type><fmt></fmt></mcd> |
Note that Type and fmt are purposely empty - XMLNSC does not use them. |
|
Back to top |
|
 |
Jain |
Posted: Mon Nov 14, 2011 9:41 am Post subject: |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
kimbert wrote: |
http://publib.boulder.ibm.com/infocenter/wmqv7/v7r0/topic/com.ibm.mq.csqzaw.doc/jm25440_.htm
Read the section 'The <mcd> folder'
Please note that the table contains errors - it should say this:
Code: |
mcd.Msd string <mcd><Msd>parserName</Msd></mcd>
mcd.Set string <mcd><Set>messageSetName</Set></mcd>
mcd.Type string <mcd><Type>globalElementName</Type></mcd>
mcd.Fmt string <mcd><Fmt>physicalFormatName</Fmt></mcd> |
You will be using XMLNSC. so your <mcd> folder will look something like this:
Code: |
<mcd><Msd>XMLNSC</Msd><set>yourMessageSet</set><Type></Type><fmt></fmt></mcd> |
Note that Type and fmt are purposely empty - XMLNSC does not use them. |
Thks kimbert bt m trying to validate the wrapped XML using the msg set details and it should be Generic means anyone can validate their xml using corresponding msg sets details without doing any changes in d code n node. The result be only True/False.
I'm taking d msg sets details in following manner
set mset = InputRoot.xmlnsc.X:R.X:nk.n1
set mtype = InputRoot.xmlnsc.X:R.X:nk.n2
set mformat = InputRoot.xmlnsc.X:R.X:nk.n3 (XML1)
set mdomain = InputRoot.xmlnsc.X:R.X:nk.n4 (XMLNSC)
and XML
set msgData = InputRoot.XMLNSC.X:R.X .*[1]
Now i'm doing msgData validation by converting in to bitstream and den parsing. |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Nov 14, 2011 10:15 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
Jain wrote: |
Thks kimbert bt m trying to ... in d code n node. I'm taking d msg sets details ... Now i'm doing msgData validation by converting in to bitstream and den parsing. |
f we hd ur mbl nbr we cld txt u ur ans. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 15, 2011 1:23 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
trying to validate the wrapped XML using the msg set details and it should be Generic means anyone can validate their xml using corresponding msg sets details without doing any changes in d code n node. The result be only True/False. |
I understand what you're trying to do, and you're doing it the hard way. Please read the following paragraph carefully, and ask questions if you still don't understand.
If your incoming message has an RFH2 header then the Domain/set/type/format properties on the input node will be overridden by the properties in the <mcd> folder of the RFH2 header. I know this works because we use it all the time here in Hursley. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Nov 15, 2011 2:30 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
kimbert wrote: |
If your incoming message has an RFH2 header then the Domain/set/type/format properties on the input node will be overridden by the properties in the <mcd> folder of the RFH2 header. I know this works because we use it all the time here in Hursley. |
The ONLY way to avoid this override this is to read the message as a BLOB, remove the RFH2 Header and then parse it using your own message defs.
Whilst some people see this 'override' as a positive feature, you will run into problems when the MessageSet def included in the RFH2 header is not deployed.
Personally, I'd use this 'feature' with caution. You have to make sure that any updates to the message set/flow at the receiving end are properly propagated to the sender. _________________ 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 |
|
 |
kimbert |
Posted: Tue Nov 15, 2011 4:00 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
smdavies99: Jain positively *wants* the per-message override ( with all of the attendant risks that you correctly point out ). I'm just pointing out that there is a product feature for that - he doesn't have to design his own 'header' structure for the meta-data and write custom code to process it. |
|
Back to top |
|
 |
Jain |
Posted: Tue Nov 15, 2011 11:18 am Post subject: |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
lancelotlinc wrote: |
Jain wrote: |
Thks kimbert bt m trying to ... in d code n node. I'm taking d msg sets details ... Now i'm doing msgData validation by converting in to bitstream and den parsing. |
f we hd ur mbl nbr we cld txt u ur ans. |
Last edited by Jain on Tue Nov 15, 2011 11:45 pm; edited 1 time in total |
|
Back to top |
|
 |
Jain |
Posted: Tue Nov 15, 2011 11:21 am Post subject: |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
kimbert wrote: |
smdavies99: Jain positively *wants* the per-message override ( with all of the attendant risks that you correctly point out ). I'm just pointing out that there is a product feature for that - he doesn't have to design his own 'header' structure for the meta-data and write custom code to process it. |
Kimbert i'm new to this.Can you pls send me sample code on my mailid. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 15, 2011 12:33 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Can you pls send me sample code on my mailid. |
No - this site is for technical advice and hints. The idea is that you make your problem public, and then others can read it and find the solution.
I am suggesting that you change the upstream application so that it sends only the body XML ( the X tag and its children ). If possible, the message set and message type should be put into the <mcd> folder of an RFH2 header by the sending application. I am assuming that you can change the sending application because this looks like a message format designed by somebody in your own organization.
btw, you are supplying more information than XMLNSC can use.
- No point in supplying the message domain - you already know that it is 'XMLNSC'
- You must supply the message set name.
- You can supply the message type, but XMLNSC will not check it against the incoming message.
- No point in supplying the message format - XMLNSC does not use it
Hope that helps. |
|
Back to top |
|
 |
Jain |
Posted: Tue Nov 15, 2011 11:43 pm Post subject: |
|
|
 Novice
Joined: 11 Nov 2011 Posts: 21
|
kimbert wrote: |
Quote: |
Can you pls send me sample code on my mailid. |
No - this site is for technical advice and hints. The idea is that you make your problem public, and then others can read it and find the solution.
...... - No point in supplying the message format - XMLNSC does not use it
Hope that helps. |
My InputRequest is
<?xml version="1.0" encoding="UTF-8"?>
<NameSpace:VRequest echoRequest="false"
xmlns:NameSpace="https://nk.rqps.com/data/Validation003">
<NameSpace:ValidationArtifact>
<NameSpace:MessageSetDetails>
<NameSpace:MessageDomain>XMLNSC</NameSpace:MessageDomain>
<NameSpace:MessageSet></NameSpace:MessageSet>
<NameSpace:MessageType></NameSpace:MessageType>
<NameSpace:MessageFormat>XML1</NameSpace:MessageFormat>
</NameSpace:MessageSetDetails>
</NameSpace:ValidationArtifact>
<NameSpace:Body>
BODY(xml and also non-xmll) THAT NEED TO BA VALIDATED AGAINST THE MSG DETAILS WHICH IS IN THE <NameSpace:MessageSetDetails> TAG.
</NameSpace:Body>
</NameSpace:VRequest>
I can't do any modification in the request format given to me. I just need to give msgset details and the xml inside the <NameSpace:Body> tag.
And also i don't have to do validation at the Input as well as output node.This is the reason why i've been told to not use RFH2 header concept.
I'm using the code
declare parseOptions integer BITOR(FolderBitStream, ValidateContent, ValidateValue);
declare payload blob asbitstream(InputRoot.XMLNSC.NameSpace:VRequest.NameSpace:BodyXML
ENCODING InputRoot.Properties.Encoding CCSID 1208 SET 'KQ9NEA0002001' TYPE 'msg_SampleRequest');
CREATE LASTCHILD OF OutputRoot DOMAIN('XMLNSC') PARSE(payload OPTIONS parseOptions ENCODING InputRoot.Properties.Encoding
CCSID 1208 SET 'KQ9NEA0002001' TYPE 'msg_SampleRequest');
I'm Setting properties(at MQinput)as Input Message parsing "Message Domain = XMLNSC"
and "Validation = None".
thks kimbert.My req was like above and got solution from the link
http://www.mqseries.net/phpBB2/viewtopic.php?t=49318
CASE2 : I also need to validate base64 data which will be inside the <NameSpace:Body> tag.but m getting error in this part |
|
Back to top |
|
 |
|