Author |
Message
|
vasanthi |
Posted: Fri Aug 19, 2005 5:45 am Post subject: xml validation problem |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
Hi
i am having a small problem when validating my xml input message.the problem is i have created a message set for my input xml by using an xsd file.the reason i have created the message set is because i need to validate the content of the incoming xml message.
my flow is like this
mqinputnode--->compute node---->mqoutputnode
for my input node i have set the properties
validate-->content and value
timing--->complete
input domain-->MRM
format--->xml
the message type--->Test
a sample input xml message
<Test>
<name>vas</name>
<age>24</age>
<date>08-23-2005</date>
--------
-------
</Test>
say for example age is of type integer.and if i send it as <age>24.5</age> it is failing the validation at the input node.until here it is fine.and if i give it as <age12>24</age12> again it is failing the validation saying invalid member for type content closed. but my actual problem is when i pass an input xml message of type Test with entirely different set of elements that are not defined in the message set i want it to fail the validation at the input node.but it is not failing.it goes to the output node.
for example if i send this message as input
<Test>
<desc>vas</desc>
<id>555</id>
<key>1234</key>
----
-----
</Test>
here the elements desc,id and key are not defined in the message set.if i send this xml as input it is not failing the validation at the input node.it goes to the output node.
can you tell me where i am doing wrong.i am using WBIMB5.0 and csd 4.
regards
vasanthi |
|
Back to top |
|
 |
kimbert |
Posted: Mon Aug 22, 2005 12:52 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi vasanthi,
Thanks for giving a really clear description of the problem. My first thought was that the entire message was self-defining (a common error) but if 'age12' gets rejected, you must be doing most things correctly.
I'm a bit puzzled, to be honest. I cannot see why 'age12' would cause a validation error when 'desc', 'id' and 'key' do not. Are you quite sure that you were using the same setup in both cases? I'm wondering whether your second message had a mis-spelled root tag, or maybe the message properties were specified wrongly. |
|
Back to top |
|
 |
kishoreraju |
Posted: Mon Aug 22, 2005 3:55 am Post subject: |
|
|
Disciple
Joined: 30 Sep 2004 Posts: 156
|
I faced the same problem when i worked on this.
I don't why its happening like that.
I know that the below is not a fix for u r problem. in worst case we can try like this.
Find the cardinality of u r root element in the compute node.
it will give one when u r using actual input and zero for any other input. if the cardinality is zero throw an user exception. |
|
Back to top |
|
 |
kimbert |
Posted: Mon Aug 22, 2005 4:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
kishoreraju,
I don't think vasanthi's problem has anything to do with cardinality. He wants any extra, unmodeled fields in his input message to trigger a validation exception. |
|
Back to top |
|
 |
vasanthi |
Posted: Mon Aug 22, 2005 12:04 pm Post subject: |
|
|
Apprentice
Joined: 23 Apr 2005 Posts: 42
|
Thanks for the replies.
i am sorry that i have forgotten to mention that i have created the message set with namespace support.
say for example my namespace is 'http://www.abc.com/Testso in my input xml message the message comes like this
<Test xmlns='http://www.abc.com/Test'>
<name>vas</name>
<age>24</age>
<date>08-23-2005</date>
--------
-------
</Test>
for this the validation is working fine. but say if i give it as
<Test xmlns='http://www.abc.com/Test'>
<desc>vas</desc>
<id>555</id>
<key>1234</key>
----
-----
</Test>
as you can see that here the elements are differnt from what i have created in the message set.it is not failing the validation at input node but going to output.
but for example if i give it as
<Test25 xmlns='http://www.abc.com/Test'>
<desc>vas</desc>
<id>555</id>
<key>1234</key>
----
-----
</Test25>
it is failing the validation at the input node because the message type Test25 is different from Test as created in message set.
so where am i doing wrong.so can you give me some idea how this namespace concept works during validation. |
|
Back to top |
|
 |
kishoreraju |
Posted: Mon Aug 22, 2005 8:22 pm Post subject: |
|
|
Disciple
Joined: 30 Sep 2004 Posts: 156
|
Try by changing the content validation property of the message set complex type. i think that is the only option that we have. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Aug 23, 2005 12:53 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
OK. Make sure that
- The 'Root tag' property on the XML physical format is empty.
- All your complex types and groups have Content Validation set to 'Closed'
- No complex types have the 'Mixed' property set.
By the way - the error message about different message types is not a validation error. Therefore it is still possible that the entire message is self-defining. If you want to check this, put a trace node after the input node, and post the message tree here. |
|
Back to top |
|
 |
slimshady |
Posted: Tue Aug 23, 2005 3:06 am Post subject: |
|
|
Newbie
Joined: 21 Aug 2005 Posts: 4
|
I was able to test the above problem that vasanthi was facing. I created a sample message as she described and able to test. when I used the same format that I defined in the schema, I was able to read it from the output queue. When I included a tag thats not defined in the schema it never reached the out queue. All the messages are sitting in the Input Queue. When I looked at the system logs
( WBRK_BROKER.db2admin ) Invalid Wire Format Identifier ''.
When processing an MRM message the broker requires a valid wire format identifier.
Check that you have packaged the message correctly and set the correct message properties then resubmit the message.
Hope this helps..
Thx |
|
Back to top |
|
 |
kishoreraju |
Posted: Tue Aug 23, 2005 3:39 am Post subject: |
|
|
Disciple
Joined: 30 Sep 2004 Posts: 156
|
Can u post the Message defination that you are using and the input message that is failing when you are testing |
|
Back to top |
|
 |
slimshady |
Posted: Tue Aug 23, 2005 3:53 am Post subject: |
|
|
Newbie
Joined: 21 Aug 2005 Posts: 4
|
I have used an external schema file to define the message defintion. Here is the shcema file contents
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://xp.com"
xmlns="http://www.w3schools.com"
elementFormDefault="qualified">
<xs:element name="note">
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
<xs:element name="priority" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Message file contents
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified"
targetNamespace="http://rp.com" xmlns="http://www.w3schools.com"
xmlns:Q1="http://xp.com" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="note">
<xs:annotation>
<xs:appinfo source="WMQI_APPINFO">
<MRMessage messageDefinition="/note;XSDElementDeclaration/"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="to" type="xs:string"/>
<xs:element name="from" type="xs:string"/>
<xs:element name="heading" type="xs:string"/>
<xs:element name="body" type="xs:string"/>
<xs:element name="priority" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="complexType1">
<xs:sequence/>
</xs:complexType>
<xs:element name="message" type="xs:string"/>
</xs:schema>
Hope this helps. |
|
Back to top |
|
 |
slimshady |
Posted: Tue Aug 23, 2005 3:59 am Post subject: |
|
|
Newbie
Joined: 21 Aug 2005 Posts: 4
|
OOps forget the test xml. I included the <test> xml tag which is not included in the message definition.
<?xml version="1.0"?><note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3schools.com note.xsd">
<to>Tove</to>
<from>Jani</from>
<test>Whats up</test>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
<priority>1</priority>
</note> |
|
Back to top |
|
 |
kimbert |
Posted: Wed Aug 24, 2005 12:45 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
slimshady:
Your problem is different from vasanthi's problem.
Quote: |
When processing an MRM message the broker requires a valid wire format identifier. |
You have not set the MessageFormat property (correctly) in the message properties. You need to do this either in the MQInput node properties or using an RFH2 header on the message. |
|
Back to top |
|
 |
|