Simon Laws wrote:
On 4/16/07, Simon Laws <[EMAIL PROTECTED]> wrote:
I'm having problems getting XSD includes to load in the databinding
itest
so am interested to know if we are using a different version of
o.a.ws.common.XmlSchema than used to be the case. I'm getting an NPE in
this package because the baseUri in the XmlSchemaCollection is not
set up
correctly. I'm going to dig into why this is the case but if anyone
knows
why things have changed or is alos getting this effect I would be
interested
to know.
Simon
OK, so I have not solved this satisfactorily but I have put in a work
around
on my machine. I added the following lines to
WSDLDocumentProcessor.read()
(the two lines I added are the ones with the comment above them).
// Read inline schemas
Types types = definition.getTypes();
if (types != null) {
wsdlDefinition.getInlinedSchemas().setSchemaResolver(new
URIResolverImpl());
for (Object ext : types.getExtensibilityElements()) {
if (ext instanceof Schema) {
Element element = ((Schema)ext).getElement();
// TODO: temporary fix to make includes in
imported
// schema work. The XmlSchema library was
crashing
// because the base uri was not set. This
doesn't
// affect imports.
XmlSchemaCollection schemaCollection =
wsdlDefinition.getInlinedSchemas();
schemaCollection.setBaseUri
(((Schema)ext).getDocumentBaseURI());
wsdlDefinition.getInlinedSchemas().read(element,
element.getBaseURI());
}
}
}
The scenario I have is:
WSDL <import..---> XSD <inlcude..---> XSD
The impact of this change is that the includes are processed BUT they are
processed relative to the base URI I set up, i.e. the URI of of the WSDL
document not the URI of the XML that includes them. I can work round this
for the time being as all the XSDs are in the same directory (and this
lets
me get on and work through the rest of the test) but it's not a generic
solution. So this needs some more work to either work out how to
configure
the XmlSchema library properly or take a look at the latest version to
see
if this apparent problem is fixed.
Simon
Simon, what you've done looks like the right fix to me as an XSD include
from an XML schema inlined in a WSDL document should be loaded relative
to the WSDL document.
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]