|
|
|
[
Permlink
| « Hide
]
Matt Solnit - 28/Jun/06 04:35 PM
Attaching the Aegis mapping file for the complex type.
I'm kinda surprised that this can happen. I'll have to do some digging. Any chance you have the stax-dev-1.1.x jar on your classpath?
Hi Dan. Thanks for your response. My current classpath is stax-api-1.0.1.jar and wstx-2.0.6.jar. I also tried with Woodstox 2.9.3 instead of 2.0.6, but the behavior was the same.
Would it help if I provide a complete sample? Hi Matt, Sorry for the long delay.... A complete sample would definitely help
A modified version of the XFire BookService example that demonstrates the problem. Includes an HTML UI for testing.
I was writing some more information, but looks like you beat me to it
The attached sample is basically a small mod of xfire/examples/book. The changes are:
The reason that I added the Aegis file is to control the namespace that Book appears in. If I exclude the mapping file, then the problem does not occur, but Book is not in the same namespace as the actual service. To reproduce the problem, browse to TestBookService.html and try the following SOAP: <?xml version='1.0' encoding='UTF-8'?> You should get an error that the author is missing. I'm looking at your example. Your namespaces don't match - in the aegis.xml file you say the namespace is "http://xfire.codehaus.org/BookService", but in your example message its "http://demo.xfire.codehaus.org". Also, your putBook element doesn't have a namespace and it should be "http://xfire.codehaus.org/BookService".
Arg, could I have confused myself while creating this sample? It's the classic problem of "can't share my corporate code, and of course the little sample works just fine". I'll try again
OK, I think I know what's going on. I appreciate your help and I apologize for leading you in the wrong direction before.
The problem, as far as I can tell, only shows up when using attributes. So if you put the following in the Aegis file: and use the following SOAP message: <?xml version='1.0' encoding='UTF-8'?> then you get the error. However, if you prefix-qualify the namespace, as shown below: <?xml version='1.0' encoding='UTF-8'?> then it works. I hope this helps. Hi Matt,
Your XML is wrong. The author in this example is not associated with any namespace: <book xmlns='http://xfire.codehaus.org/BookService' author='Dan'> The XML Namespace specification says: A default namespace declaration applies to all unprefixed element names within its scope. Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear. ... The namespace name for an unprefixed attribute name always has no value. So a correct version with book having an empty prefix would be: <book xmlns='http://xfire.codehaus.org/BookService' xmlns:b="xmlns='http://xfire.codehaus.org/BookService'" b:author='Dan'> Hi Dan. I read the spec and it looks like you're right. Thanks for checking this out.
The XML Schema Primer backs this up: However, the Xerces XSD validator will allow un-prefixed attributes. This is how I got confused. Maybe Xerces is wrong. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||