tuscany-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Laws" <simonsl...@googlemail.com>
Subject Re: Loading XSD includes?
Date Mon, 16 Apr 2007 11:43:28 GMT
On 4/16/07, Simon Laws <simonslaws@googlemail.com> 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message