users@jaxb.java.net

Re: undefined element declaration using xjc api

From: Dan Diephouse <dan_at_envoisolutions.com>
Date: Mon, 14 Aug 2006 14:53:37 -0400

Kohsuke Kawaguchi wrote:
>
> 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.
>
*Dan mutters bad bad things about Java and XML under his breath...*
>> 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.
A couple questions about that. First, I already have the schema adding
to the schema compiler. You think I should just return an InputSource
with a systemId referring to that schema - i.e.
http://..../Service.wsdl#types?schema1? Second, what if there are
multiple schemas with that same namespace in that wsdl. It would seem to
me (because I'm lazy ;-)) that JAXB should be able to determine that a
schema is importing all the schemas of that namespace and work accordingly.
> 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.
>
I don't think this is the issue, its more that I've added all the
schemas and it seems that JAXB requires a System Id for the <import> or
it won't know what to do. Is this correct?
>
> 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 :-)
>
Hehe, OK, the issue is we already have our WSDL parsed into a DOM from
WSDL4J, so I didn't really want to reparse. Any suggestions?
> [1]
> http://forums.java.net/jive/thread.jspa?forumID=46&threadID=17396&messageID=141495#141495
>
Thanks for this!

Cheers,
- Dan

-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com
http://netzooid.com/blog