I checked in a more elegant fix under r783211 to use local copies of
external XSDs if the namespace matches.
Thanks,
Raymond
--------------------------------------------------
From: "Raymond Feng" <[email protected]>
Sent: Tuesday, June 09, 2009 6:11 PM
To: "tuscany-dev" <[email protected]>
Subject: SCA Schema validation issues
Hi,
The SCA XSDs from OASIS has "import" to XSD files on the web. This makes
our schema validation unreliable as it tries to connect to the internet.
I'm seeing failure in assembly-xml:
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name
'wsdli:wsdlL
ocation' to a(n) 'attribute declaration' component.
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAX
ParseException(ErrorHandlerWrapper.java:195)
at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Err
orHandlerWrapper.java:131)
at
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(
XMLErrorReporter.java:384)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.repo
rtSchemaErr(XSDHandler.java:2537)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.repo
rtSchemaError(XSDHandler.java:2528)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getG
lobalDecl(XSDHandler.java:1396)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAttributeTra
verser.traverseLocal(XSDAttributeTraverser.java:83)
at
com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDAbstractTrav
After hours of debug, I found the underlying error is caused by the
following exception. It seems that the connection from URL.openStream() is
rejected even though it can be accessed from the browser (not sure if it
is an anti-spamming thing).
java.io.IOException: Server returned HTTP response code: 403 for URL:
http://www.w3.org/2001/datatypes.dtd
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1305)
at java.net.URL.openStream(URL.java:1009)
I found a workaround by setting a feature on the SchemaFactory.
// Set the feature to avoid DTD processing
schemaFactory.setFeature("http://xml.org/sax/features/external-parameter-entities",
false);
I'm also trying to add a Resolver so that XSDs on the web can be
redirected to a local copy.
Thanks,
Raymond