On 10-Sep-09, at 10:02 PM, Michael Glavassevich wrote:
Also, they really should be setting an error handler. Because they
haven't, any warnings which may have helped you determine what the
issue is:
"schema_reference.4: Failed to read schema document './schemas/
Schemas/FICR_IN620104CA.xsd', because 1) could not find the
document; 2) the document could not be read; 3) the root element of
the document is not <xsd:schema>."
are being silently ignored.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org
Michael Glavassevich/Toronto/i...@ibmca wrote on 09/10/2009 10:54:42
PM:
> Hi Craig,
>
> The CXF code you've shown is not setting a system ID on the
> DOMSource it's passing to the SchemaFactory. This is a common
> programming error and I suspect that's the reason why this is
> failing. The relative URIs in the schema (embedded in the WSDL)
> require a base URI for resolution. CXF should be providing one by
> calling DOMSource.setSystemId() [1].
>
> Thanks.
>
> [1] http://xerces.apache.org/xerces2-
> j/javadocs/api/javax/xml/transform/dom/DOMSource.
> html#setSystemId(java.lang.String)
>
Hmm, I see. I can kind of understand why they wouldn't be setting the
SystemID as they might not know how to gleam what it should be (in all
cases). When I'm in front of the code tomorrow I'll see if I can
deduce what it should be within the context of that call. Otherwise,
is there a way in the WSDL I can set the SystemId? Or perhaps you are
saying that even if the SystemId were present in the WSDL CXF wouldn't
be respecting it?
Thanks Michael.
Craig.
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrgla...@ca.ibm.com
> E-mail: mrgla...@apache.org
>
> Craig Tataryn <crai...@tataryn.net> wrote on 09/09/2009 11:18:14 PM:
>
> > Hi, having problems with Xerces. I'm using CXF's wsdl2java build
> > plugin to generate java classes. Xerces seems to be choking
with the
> > following error:
> >
> > Caused by: org.xml.sax.SAXParseException: src-resolve: Cannot
resolve
> > the name 'hl7:FICR_IN610104CA' to a(n) 'element declaration'
> > component.
> > at
> > org
>
>
.apache
.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
> > Source)
> > at
org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown
> > Source)
> > at
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> > Source)
> > at
org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
> > Source)
> > at
> > org
>
>
.apache
.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(Unknown
> > Source)
> > at
> >
org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(Unknown
> > Source)
> > at
> > org
> > .apache
>
> .xerces.impl.xs.traversers.XSDElementTraverser.traverseLocal(Unknown
> > Source)
> > at
> > org
> > .apache
>
> .xerces.impl.xs.traversers.XSDHandler.traverseLocalElements(Unknown
> > Source)
> > at
> >
org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(Unknown
> > Source)
> > at
> > org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown
Source)
> > at
> > org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown
Source)
> > at
> > org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown
Source)
> > at
> >
org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown
> > Source)
> > at javax.xml.validation.SchemaFactory.newSchema(Unknown
Source)
> > at
> > org
> > .apache
> > .cxf
> > .tools
> > .wsdlto
>
>
.databinding
.jaxb.JAXBDataBinding.validateSchema(JAXBDataBinding.java:
> > 642)
> >
> > The line of code where this error is caught is in
JAXBDataBinding, the
> > SchemaFactory is indeed a Xerces one
> > (org.apache.xerces.jaxp.validation.XMLSchemaFactory) at runtime
and
> > it's failing on the newSchema(domSrc) call:
> >
> > public void validateSchema(Element ele) throws ToolException {
> > SchemaFactory schemaFact =
> > SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
> > DOMSource domSrc = new DOMSource(ele);
> > try {
> > schemaFact.newSchema(domSrc);
> > } catch (SAXException e) {
> > if (e.getLocalizedMessage().indexOf("src-resolve.
4.2") >
> > -1) {
> > //Ignore schema resolve error and do nothing
> > } else {
> > throw new ToolException("Schema Error : " +
> > e.getLocalizedMessage(), e);
> > }
> > }
> > }
> >
> > Now for sake of brevity I've only attached the wsdl and the schema
> > that contains the FICR_IN610104CA element. Xerces doesn't seem
to be
> > able to cope with the "urn:hl7-org:v3" namespace, it doesn't
seem to
> > realize that it's the targetNamespace for the
FICR_IN610104CA.xsd...
> > If anyone needs the fullset of schemas let me know, I can send
them
> > directly to you.
> >
> > Any help would be greatly appreciated, XMLSpy and Eclipse don't
seem
> > to have any problems, they validate the wsdl and schema without
> > problem. The version of XercesImpl being used is: 2.8.1,
although I
> > did try with 2.9 as well but with the same effect.
> >
> > Any other detail someone might need, let me know.
> >
> > Craig.
> >
> > --
> > Craig Tataryn
> > site: http://www.basementcoders.com/
> > podcast:http://feeds.feedburner.com/TheBasementCoders
> > irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
> > twitter: craiger
> >
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> > For additional commands, e-mail: j-users-h...@xerces.apache.org