Author |
Message
|
p.cradwick |
Posted: Fri Mar 27, 2009 12:14 am Post subject: Validating wildcards in a validation node |
|
|
Acolyte
Joined: 16 May 2001 Posts: 56
|
Hi,
I am having trouble validating XMLNSC in a validation node. Broker 6.1
The MsgSet has header elements that validate ok including an attribute field, but these
are followed by a wildcard element that had the 'ProcessContent' set to 'lax'
and I have specified the namespace: ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0
The excerpt from the trace file is as follows:
BIP5494I: The logical tree is now being matched to the message model.
BIP5564I: Item ''methodName'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/methodName''.
BIP5564I: Item ''params'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params''.
BIP5564I: Item ''header'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/header''.
BIP5564I: Item ''version'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/header/ATTRGROUP_/version''.
BIP5564I: Item ''SchemeID'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/header/[SEQUENCE]/SchemeID''.
BIP5564I: Item ''PayloadID'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/header/[SEQUENCE]/PayloadID''.
BIP5564I: Item ''payload'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload''.
BIP5564I: Item ''Batch'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch''.
BIP5564I: Item ''header'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/header''.
BIP5564I: Item ''MemberDetailsUpdateToProvider'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/header/[UNORDEREDSET]/MemberDetailsUpdateToProvider''.
BIP5564I: Item ''PaymentToScheme'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/header/[UNORDEREDSET]/PaymentToScheme''.
BIP5564I: Item ''RefundCorrectionRequest'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/header/[UNORDEREDSET]/RefundCorrectionRequest''.
BIP5564I: Item ''ControlTotalsNPToProvider'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/header/[UNORDEREDSET]/ControlTotalsNPToProvider''.
BIP5564I: Item ''InvalidEnrolmentCloseAccount'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/header/[UNORDEREDSET]/InvalidEnrolmentCloseAccount''.
BIP5564I: Item ''payload'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/payload(1 of unbounded)''.
BIP5564I: Item ''methodCall'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/payload(1 of unbounded)/WILDCARD_/[MESSAGE]_methodCall''.
BIP5564I: Item ''methodName'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/payload(1 of unbounded)/WILDCARD_/[MESSAGE]_methodCall/methodName''.
BIP5564I: Item ''params'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/payload(1 of unbounded)/WILDCARD_/[MESSAGE]_methodCall/params''.
BIP5564I: Item ''header'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/payload(1 of unbounded)/WILDCARD_/[MESSAGE]_methodCall/params/header''.
BIP5564I: Item ''@version'' from the logical tree has matched with the message model as ''[MESSAGE]_methodCall/params/payload/WILDCARD_/[OPENDEFINED]_Batch/payload(1 of unbounded)/WILDCARD_/[MESSAGE]_methodCall/params/header/[SELF_DEFINING]''.
BIP5493W: Message, element or attribute 'version' is self-defining within parent 'ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:header'.
The message, element or attribute 'version' did not match with any corresponding
artifact in the message model hence it is considered to be self-defining.
The input XML looks like:
(0x01000021:Name+):MRM = ( ['mrm' : 0x7f444f0]
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodName = 'KS.MessageBatch' (CHARACTER)
(0x01000013:Name+ )ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:params = (
(0x01000013:Name+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:header = (
(0x0300000B:NameValue+):version = '4.0' (CHARACTER)
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:SchemeID = 'KSS/10045' (CHARACTER)
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:PayloadID = 'KSS/123451610000000000000015' (CHARACTER)
)
(0x01000013:Name+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:payload = (
(0x01000013:Name+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:Batch = (
(0x01000013:Name+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:header = (
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:MemberDetailsUpdateToProvider = 2 (DECIMAL)
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:PaymentToScheme = 5 (DECIMAL)
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:RefundCorrectionRequest = 1 (DECIMAL)
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:ControlTotalsNPToProvider = 1 (DECIMAL)
(0x0300000B:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:InvalidEnrolmentCloseAccount = 1 (DECIMAL)
)
(0x01000013:Name+)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:payload = (
(0x01000015:Name+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodCall = (
(0x0300000D:NameValue+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodName = 'KS.PaymentToScheme' (CHARACTER)
(0x01000015:Name+ )ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:params = (
(0x01000015:Name+)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:header = (
(0x0300000D:NameValue+):@version = '4.0' (CHARACTER)
Can anyone explain why the validation fails at the 'version' attribute of the WildCard 'methodCall'?
Peter |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 27, 2009 3:21 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Can anyone explain why the validation fails at the 'version' attribute of the WildCard 'methodCall'? |
Yes. You're using MRM validation, not XMLNSC
I know that for sure because you were kind enough to supply the user trace. That gives the game away immediately - only the MRM parser outputs BIP5494I. |
|
Back to top |
|
 |
p.cradwick |
Posted: Mon Mar 30, 2009 1:44 am Post subject: |
|
|
Acolyte
Joined: 16 May 2001 Posts: 56
|
Yes you are right in your conclusions, Kimbert, what I am trying to do is validate XML against a schema. So I used the schema to create a message set and am using that in a validate node, but first converting the domain to MRM (RCD). I had used this 'pattern' successfully before (but without wildcards in the schema!) and thought it was the right way to do it.
What is the correct way to validate input XML against a schema?
B.T.W. you can see now you confused 'kindness' for 'stupidity' or perhaps 'desperation'
Peter |
|
Back to top |
|
 |
kimbert |
Posted: Mon Mar 30, 2009 3:00 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Ah. I don't think you meant to write this:
Quote: |
I am having trouble validating XMLNSC in a validation node. Broker 6.1 |
I presume you meant to say:
Quote: |
I am having trouble validating XML in a validation node. Broker 6.1 |
Quote: |
What is the correct way to validate input XML against a schema? |
XMLNSC is a far more accurate XML validator than MRM, and much faster. Always use XMLNSC when you have the choice.
Quote: |
B.T.W. you can see now you confused 'kindness' for 'stupidity' or perhaps 'desperation' |
Nope. Because you took time to provide the user trace, I did not have to
- wonder whether you were actually using MRM
- construct a post asking you whether you were definitely using MRM
- think about other possible reasons why the validation might have failed.
Instead, I was able to diagnose the problem instantly. Thank you. |
|
Back to top |
|
 |
p.cradwick |
Posted: Mon Mar 30, 2009 11:02 am Post subject: |
|
|
Acolyte
Joined: 16 May 2001 Posts: 56
|
Ok, after a small dose of R.T.F.M. the input XML to the validation node now looks like:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x76d0b28]
(0x01000400:NamespaceDecl):XmlDeclaration = (
(0x03000100:Attribute):Version = '1.0' (CHARACTER)
(0x03000100:Attribute):Encoding = 'UTF-8' (CHARACTER)
)
(0x01000000:Folder )ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodCall = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:xsi = 'http://www.w3.org/2001/XMLSchema-instance' (CHARACTER)
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:tns = 'ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0' (CHARACTER)
(0x03000000:PCDataField )ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodName = 'KS.MessageBatch' (CHARACTER)
(0x01000000:Folder )ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:params = (
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:header = (
(0x03000100:Attribute ):version = '4.0' (CHARACTER)
(0x03000000:PCDataField)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:SchemeID = 'KSS/10045' (CHARACTER)
(0x03000000:PCDataField)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:PayloadID = 'KSS/123451610000000000000015' (CHARACTER)
)
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:payload = (
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0:Batch = (
(0x03000102:NamespaceDecl)http://www.w3.org/2000/xmlns/:tns = 'ABC:xyz:IRD:KS:B2BInterfaces:Batch:v5.0' (CHARACTER)
but it still doesn't seem to be interpreting the wildcard:
BIP5026E: XML schema validation error: 'cvc-complex-type.2.4.e: Unexpected element. Element "tns:Batch" is not one of the choices.'
Element: '/Root/XMLNSC'
There are no 'choice' elements in the schema, the Batch element corresponds to the wildcard element of the schema:
Still puzzled
 |
|
Back to top |
|
 |
kimbert |
Posted: Mon Mar 30, 2009 1:32 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
There are no 'choice' elements in the schema, the Batch element corresponds to the wildcard element of the schema |
I agree that the error message could be better. The 'choice' is actually the wildcard, which is equivalent to a choice of all global element declarations in the message set.
'lax' means 'look for a definition of tns:Batch in all available schemas'. So is 'Batch' defined somewhere in your message set? In the *exactly* correct namespace ( or to put it another way, is there any global element declaration in the message set which corresponds exactly with tns:Batch in your message tree? ) |
|
Back to top |
|
 |
p.cradwick |
Posted: Mon Mar 30, 2009 1:35 pm Post subject: |
|
|
Acolyte
Joined: 16 May 2001 Posts: 56
|
Found the problem
On one of my earlier attempts at solving the problem I associated a namespace with the wildcard, but of course the Batch element used a different n/s!
Thanks for your help Kimbert  |
|
Back to top |
|
 |
|