Author |
Message
|
dsriksha |
Posted: Wed Feb 15, 2006 10:38 am Post subject: XML message validation |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
In my flow am dynamically generating XML messages(with namespaces) in XMLNS domain. This XML message matches in structure with the XML message generated from XML schema (Which I got from client side).
I found out from the XML schema(Which I got from client) that some of the elements are of diffrent data type say int, boolean, timestamp. Where as my message (in XMLNS) contains char type elements.
I have gone through this link and manuals
http://www.mqseries.net/phpBB2/viewtopic.php?t=18988&highlight=schema
My question is do I need validation (from the above situation) against the XML Schema imported messageset (of course in MRM domain)?
I really appreciate the answer with little explanation or just Y or N.
I believe that the answer is N.
Last edited by dsriksha on Wed Feb 15, 2006 2:24 pm; edited 1 time in total |
|
Back to top |
|
 |
vennela |
Posted: Wed Feb 15, 2006 12:12 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Quote: |
This XML message matches in structure with the XML message generated from XML schema (Which I got from client side). |
Quote: |
I found out from the XML schema(Which I got from client) that some of the elements are of diffrent data type say int, boolean, timestamp. Where as my message (in XMLNS) contains char type elements. |
I think the above two statements are contradicting, unless I am missing something else.
You need to tell us more I think. |
|
Back to top |
|
 |
dsriksha |
Posted: Wed Feb 15, 2006 1:21 pm Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
Hi Vennela
Quote: |
This XML message matches in structure with the XML message generated from XML schema (Which I got from client side). |
I mean just the order of elements but not data types |
|
Back to top |
|
 |
dsriksha |
Posted: Wed Feb 15, 2006 2:02 pm Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
More details.
Am creating XML message from TDS message format, which will be sent to APPLICATION "A". This XML message is dynamically generated in compute node using ESQL with XMLNS domain. Note that all the element values are char type.
From the APPLICATION "A" I got the XML SCHEMA and confirmed that order of elements is correct, but not the datatypes.
Now, my quetion is about validation. Can I send the XMLmessage without validation? or do Ineed to validate the message. |
|
Back to top |
|
 |
dilse |
Posted: Wed Feb 15, 2006 3:24 pm Post subject: |
|
|
 Master
Joined: 24 Jun 2004 Posts: 270
|
dsriksha,
I think if you are getting in the correct order and able to generate XML successfully then it should do in general but if you want to validate the data types as well then you should create a message set corresponding to the XML Schema and assign the elements as you did it in former case. If a message goes thru you are now 100% sure that the data type is also matching and generating in the correct order. Let us know if you still have any questions.
DilSe.. |
|
Back to top |
|
 |
dsriksha |
Posted: Wed Feb 15, 2006 5:22 pm Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
Thanks Dilse.
For clarification..
When I send the XML messages datatypes also carried to the application?
(From Wbimb to some target side using WMQ)
For Example:
This is what my generated XML message with all elements are of CHAR type
<?xml version="1.0" encoding="ISO-8859-1" ?>
<MessageHeader>
<Time>2005-02-28-16.23.22</Time>
<MQID>ARROP</MQID>
<Fun>Y</Fun>
</MessagrHeader>
However client (Target side) may expect the Element "Fun" is of Boolean type (Because their XML schema defined in that way). Still the value is just 'Y'.
In this situation do I need to cast for Boolean type or just sending Char type is ok. |
|
Back to top |
|
 |
vennela |
Posted: Wed Feb 15, 2006 6:52 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Maybe you should use XSLT and XMLTransformation node.
I might be wrong though. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 16, 2006 2:18 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
'Y' is not a valid Boolean value in XML Schema. You need to use 'true' and 'false', otherwise the Client application will reject the message.
Validation will not correct this problem, although it would highlight the problem.
You need to translate Y/N to true/false in your ESQL code when you build the output message. |
|
Back to top |
|
 |
dsriksha |
Posted: Thu Feb 16, 2006 5:43 am Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
Quote: |
You need to translate Y/N to true/false in your ESQL code when you build the output message |
Thanks kimbert.
To confirm
By sending true or false as a string instead of boolean is also ok? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 16, 2006 5:54 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
By sending true or false as a string instead of boolean is also ok? |
I'm not sure what you mean. How could you 'send true or false' as anything other than a string?. The output message is XML - just a stream of characters. |
|
Back to top |
|
 |
dsriksha |
Posted: Thu Feb 16, 2006 6:24 am Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
Quote: |
The output message is XML - just a stream of characters. |
I apologize if I sound too novice. So whatever datatype we assign in esql code, since the output message is XML that becomes a character. Then why we need to do validation against datatypes for output xml messages? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 16, 2006 6:39 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Then why we need to do validation against datatypes for output xml messages? |
Because you may want to ensure that the output message conforms to the schema. In your case, you might want to trap errors like <Fun>Y</Fun> or <date>true</date> or <integer>xyz</integer> before the client application finds them and complains. |
|
Back to top |
|
 |
dsriksha |
Posted: Thu Feb 16, 2006 6:50 am Post subject: |
|
|
 Voyager
Joined: 27 Feb 2005 Posts: 95
|
thanks for Kimbert and all. |
|
Back to top |
|
 |
|