users@jaxb.java.net

Re: undefined element declaration using xjc api

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 14 Aug 2006 10:55:25 -0700

Hi,

Dan Diephouse wrote:
> 0 [main] INFO org.codehaus.xfire.gen.Wsdl11Generator - Generating
> code for WSDL at
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl
> with a base URI of
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl
> 962 [main] WARN org.codehaus.xfire.gen.jaxb.ErrorReceiverImpl -
> src-resolve: Cannot resolve the name 's1:selectType' to a(n) 'type
> definition' component. at -1,-1 in
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl#types?schema1
> 962 [main] WARN org.codehaus.xfire.gen.jaxb.ErrorReceiverImpl -
> src-resolve: Cannot resolve the name 's:schema' to a(n) 'element
> declaration' component. at -1,-1 in
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl#types?schema1
> 962 [main] WARN org.codehaus.xfire.gen.jaxb.ErrorReceiverImpl -
> src-resolve: Cannot resolve the name 's4:VOTABLE' to a(n) 'type
> definition' component. at -1,-1 in
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl#types?schema1
> 1503 [main] ERROR org.codehaus.xfire.gen.jaxb.ErrorReceiverImpl -
> undefined element declaration 's:schema' at 0,0 in
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl#types?schema1
> 1503 [main] ERROR org.codehaus.xfire.gen.jaxb.ErrorReceiverImpl -
> undefined element declaration 's:schema' at 0,0 in
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl#types?schema1
> 1503 [main] ERROR org.codehaus.xfire.gen.jaxb.ErrorReceiverImpl -
> undefined element declaration 's:schema' at 0,0 in
> file:/c:/cygwin/home/dan/xfire/xfire-generator/src/wsdl/SkyPortal.wsdl#types?schema1

See [1] for what's going on behind the scene. The problem is really in
the JAXP RI.

> I've digging through the JAXB source and still can't make heads or tails
> of the error message. As far as I can tell each schema/wsdl is correct.
> I think it is the <import namespace=""/> statements that is confusing
> things. For each import the entity resolver is being called with a null
> systemId and a publicId of the namespace in the import statement. Can
> anyone provide any insight into what might be going on?

Since the import statement doesn't contain schemaLocation, JAXP is
failing to resolve them (unless your EntityResolver is resolving them
for us.) That's why you see all sort sof "undefined declaration" error.

Have your entity resolver resolve them, or XFire WSDL compiler should
allow additional schema files to be specified via command-line option,
so that the JAXP RI (and XJC) can read all of them and find references
accordingly.


This is off topic, but I see that you are parsing WSDL into something
that doesn't retain line numbers (DOM?) It would be nice if you can keep
  line numbers around so that users see error messages with line
numbers. A lot of effort is spent in the JAXB RI to retain line numbers
and point to them, so you got to fix your side so that my effort will
see the light of the day :-)

[1]
http://forums.java.net/jive/thread.jspa?forumID=46&threadID=17396&messageID=141495#141495
-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com