Author |
Message
|
wombat2590 |
Posted: Thu Jun 20, 2002 8:12 am Post subject: Validation of XML message in WMQI 2.1 |
|
|
Newbie
Joined: 20 Jun 2002 Posts: 3
|
Hi
I am trying to determine how to validate XML messages within WMQI 2.1.
Ideally, I need to be able to import an XML DTD or schema into the Control Centre and use the message created for validation of the structure, data types, field lengths etc of any XML input message that is passed to my message flow.
I have tried to test this scenario by creating a Message Set with an XML layer. I have referenced the message set, message type etc. in the input node of my message flow. I have tried both checking and unchecking the Validate option on the Advanced tab.
My message has two fields defined within it and I would expect an exception to be thrown if a message is passed to the flow containing more fields than this. However no exception is thrown.
Furthermore, I have tried to designate one of the fields within my message as Mandatory by setting the MIN Occurs and MAX Occurs options
on that element's Connection tab to '1'. If this field is not included in the input message I would, again, expect an exception but ,again, the message goes straight to the output queue.
I have included a Compute Node and empty Trace nodes in my message flow to try to invoke the parser but still the message passed through to the output node with no apparent problem.
If the fields that should be included within the message do not appear the trace log tells me that a NULL value is assigned to any mappings of these fields specified in the Compute node thereby deleting them. The message sent to the output queue contains only the message tags.
Can anyone enlighten me as to how (or if) validation of this type can be done within 2.1?
Cheers |
|
Back to top |
|
 |
CodeCraft |
Posted: Thu Jun 20, 2002 11:48 am Post subject: |
|
|
Disciple
Joined: 05 Sep 2001 Posts: 195
|
CSD 03 for WMQI 2.1 will introduce more validation.
In the meantime, to check the structure of the incoming message against the dictionary, you must specify that the message is in the MRM domain, not the XML domain. So, in your compute node, unless the domain is specified as MRM (not XML) the set, type and format properties will not be used by the parsers.
If you parse an XML message which IS in the MRM domain, it should be checked against the message model and thrown out if it doesn't agree. |
|
Back to top |
|
 |
wombat2590 |
Posted: Fri Jun 21, 2002 12:27 am Post subject: |
|
|
Newbie
Joined: 20 Jun 2002 Posts: 3
|
Thanks for your quick reply.
I have designated the Message Domain as MRM and the Message Format at XML (XML) in the input node of my message flow. For the Message Set I have created 'MRM' is specified as the parser in the RunTime tab.
Is there any reason why this is not being picked up. I was not sure that I had designated my element as Mandatory in the correct manner (ie by setting its MIN and MAX Occurs to '1') so I tried passing through an message that included a rogue field which was not in my message set. Still no exceptions were thrown.
Any ideas? |
|
Back to top |
|
 |
CodeCraft |
Posted: Fri Jun 21, 2002 12:47 am Post subject: |
|
|
Disciple
Joined: 05 Sep 2001 Posts: 195
|
I think you should raise an IBM RFI on this, as I said, I believe there is additional validation on CSD 03, but, don't know to what extend it affects XML and can't verify how this is/should work myself without a reasonable commitment of time which I can't commit just now.
It could be a case of model properties being adjusted, or it could be a case of specific validation you need not being available. |
|
Back to top |
|
 |
wombat2590 |
Posted: Fri Jun 21, 2002 1:14 am Post subject: |
|
|
Newbie
Joined: 20 Jun 2002 Posts: 3
|
My message set message defined to the MRM looks like this
MESSAGE_IN
- FIELD1 STRING
- FIELD2 STRING
When I pass through the following message no exception is thrown:
<MESSAGE_IN>
<FIELD1> 1234</FIELD1>
<TEST>ABCD<\TEST>
</MESSAGE_IN>
When I pass through this message I do get an exception and a trace log indicates that the input message does not match the message dictionary:
<XML_IN>
<NAME>
<FIRST>ABCD</FIRST>
<LAST>1234</LAST>
</NAME>
<NAME>
<FIRST>EFGH</FIRST>
<LAST>5678</LAST>
</NAME>
</XML_IN>
The trace log tells me that the message identifer differs from that specified in the input node which is what I want. Obviously the message identifier in the first message (MESSAGE_IN) is correct but WMQI does not seem to pick up that a field included in that message (TEST) is incorrect. |
|
Back to top |
|
 |
JLRowe |
Posted: Fri Jun 21, 2002 6:52 am Post subject: |
|
|
 Yatiri
Joined: 25 May 2002 Posts: 664 Location: South East London
|
The Min occurs and max occurs values are not used by the MRM XML parser (yet).
Additionally, the parser always takes the type content as open, this is why you can include extra elements in your message.
Hopefully, this stuff will be working in CSD03. |
|
Back to top |
|
 |
Naftalanja |
Posted: Fri Jun 28, 2002 4:10 pm Post subject: |
|
|
Acolyte
Joined: 30 Jan 2002 Posts: 63 Location: Los Angeles
|
I am not sure if you have already obtained the answer for your
query, but no, you cannot validate the XML file against a schema/ dtd in MQSI. MQSI is used for routing and formatting. Well if your requirement is really in need for validating the XML then, may be writing your own node and testing for XML validation may not be that bad idea. Also reg! the rogue element in xml, to cut short the prob, please check your XML schema and its element definitions again. If the above message didn't help then no worries, let me know.  |
|
Back to top |
|
 |
|