You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Dominik Raymann <ra...@gmx.ch> on 2009/11/14 15:31:43 UTC

WSDL2JAVA, store WSDLs and XSDs locally

Hi there,

I use WSDL2JAVAto generate client code from a WSDL. I'd like to store the WSDL (and all referenced dependencies) locally so that the stubs can be generated offline. However, the WSDL references (imports) other WSDLs as well as schema files. These references are absolute URLs.

Is it possible to map these URLs to local files somehow or do I have to edit the WSDL manually and change to URLs so that they point to the local files?

Or is there a tool (wsdl2java itself?) that downloads everything needed for codegeneration and changes the references so that they point to the local copies of the files?

Thanks for your answer,

Dominik
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Craig Tataryn <cr...@tataryn.net>.
Dan, I've logged the problem and did some investigation.  Logged it as:
https://issues.apache.org/jira/browse/CXF-2599

Thanks,

Craig.

On Fri, Dec 4, 2009 at 10:51 AM, Daniel Kulp <dk...@apache.org> wrote:

> On Thu November 19 2009 12:53:33 am Craig Tataryn wrote:
> > Problem we've faced with the catalog solution is the case where the
> > XSDs your WSDL is referencing also references other XSDs in a relative
> > way.  It seems (to me) that you can't make a catalog entry which
> > overrides "../" to point to a specific place on the classpath.
> >
> > For instance:
> > WSDL has <xsd:import schemaLocation="schemas/3rdPartySchema.xsd"/>
> > We map schemas to classpath:/schemas in a catalog and that works well.
> >
> > then, in 3rdPartySchema.xsd there is a: <xsd:import schemaLocation="../
> > coreschemas/base.xsd"/>.  There seems no way to catalog "../" to point
> > to classpath:/coreschemas...
>
>
> Hmm...   You should HAVE to do anything with the catalogs in this case.
> The
> systemId for 3rdPartySchema.xsd should end up being the full URL for
> whatever
> "classpath:/schemas/3rdPartySchema.xsd" resolves to. (like
> jar:file://..../myproject.jar!/schemas/3rdPartySchema.xsd)
>
> Thus, the relative path, which would resolve from the systemId, should work
> fine for that.    If it isn't, that would be a bug and should be logged
> (with
> a testcase  :-)   ).
>
> Dan
>
>
> >
> > What happens is anytime 3rdPartySchema.xsd makes reference to an
> > element from base.xsd, it complains it's an unresolved element (but
> > doesn't seem to complain that it can't find base.xsd mind you).
> >
> > Craig.
> >
> > On 16-Nov-09, at 7:25 AM, Daniel Kulp wrote:
> > > This is exactly what the XML catalogs are designed for (and the -
> > > catalog flag
> > > on wsdl2java).     Basically, they allow URL patterns and such used
> > > for
> > > imports to be mapped into new URL's where the stuff really lives.
> > > Thus, you
> > > can have "http://..."  type URL's in the wsdl's/xsd's, but have
> > > those remapped
> > > into file things or such.
> > >
> > > Dan
> > >
> > > On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
> > >> Hi there,
> > >>
> > >> I use WSDL2JAVAto generate client code from a WSDL. I'd like to
> > >> store the
> > >> WSDL (and all referenced dependencies) locally so that the stubs
> > >> can be
> > >> generated offline. However, the WSDL references (imports) other
> > >> WSDLs as
> > >> well as schema files. These references are absolute URLs.
> > >>
> > >> Is it possible to map these URLs to local files somehow or do I
> > >> have to
> > >> edit the WSDL manually and change to URLs so that they point to the
> > >> local
> > >> files?
> > >>
> > >> Or is there a tool (wsdl2java itself?) that downloads everything
> > >> needed for
> > >> codegeneration and changes the references so that they point to the
> > >> local
> > >> copies of the files?
> > >>
> > >> Thanks for your answer,
> > >>
> > >> Dominik
> >
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>



-- 
Craig Tataryn
site: http://www.basementcoders.com/
podcast:http://feeds.feedburner.com/TheBasementCoders
irc: ThaDon on freenode #basementcoders, ##wicket, #papernapkin
twitter: craiger

Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Daniel Kulp <dk...@apache.org>.
On Thu November 19 2009 12:53:33 am Craig Tataryn wrote:
> Problem we've faced with the catalog solution is the case where the
> XSDs your WSDL is referencing also references other XSDs in a relative
> way.  It seems (to me) that you can't make a catalog entry which
> overrides "../" to point to a specific place on the classpath.
> 
> For instance:
> WSDL has <xsd:import schemaLocation="schemas/3rdPartySchema.xsd"/>
> We map schemas to classpath:/schemas in a catalog and that works well.
> 
> then, in 3rdPartySchema.xsd there is a: <xsd:import schemaLocation="../
> coreschemas/base.xsd"/>.  There seems no way to catalog "../" to point
> to classpath:/coreschemas...


Hmm...   You should HAVE to do anything with the catalogs in this case.   The 
systemId for 3rdPartySchema.xsd should end up being the full URL for whatever 
"classpath:/schemas/3rdPartySchema.xsd" resolves to. (like 
jar:file://..../myproject.jar!/schemas/3rdPartySchema.xsd)

Thus, the relative path, which would resolve from the systemId, should work 
fine for that.    If it isn't, that would be a bug and should be logged (with 
a testcase  :-)   ).

Dan


> 
> What happens is anytime 3rdPartySchema.xsd makes reference to an
> element from base.xsd, it complains it's an unresolved element (but
> doesn't seem to complain that it can't find base.xsd mind you).
> 
> Craig.
> 
> On 16-Nov-09, at 7:25 AM, Daniel Kulp wrote:
> > This is exactly what the XML catalogs are designed for (and the -
> > catalog flag
> > on wsdl2java).     Basically, they allow URL patterns and such used
> > for
> > imports to be mapped into new URL's where the stuff really lives.
> > Thus, you
> > can have "http://..."  type URL's in the wsdl's/xsd's, but have
> > those remapped
> > into file things or such.
> >
> > Dan
> >
> > On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
> >> Hi there,
> >>
> >> I use WSDL2JAVAto generate client code from a WSDL. I'd like to
> >> store the
> >> WSDL (and all referenced dependencies) locally so that the stubs
> >> can be
> >> generated offline. However, the WSDL references (imports) other
> >> WSDLs as
> >> well as schema files. These references are absolute URLs.
> >>
> >> Is it possible to map these URLs to local files somehow or do I
> >> have to
> >> edit the WSDL manually and change to URLs so that they point to the
> >> local
> >> files?
> >>
> >> Or is there a tool (wsdl2java itself?) that downloads everything
> >> needed for
> >> codegeneration and changes the references so that they point to the
> >> local
> >> copies of the files?
> >>
> >> Thanks for your answer,
> >>
> >> Dominik
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Craig Tataryn <cr...@tataryn.net>.
Problem we've faced with the catalog solution is the case where the  
XSDs your WSDL is referencing also references other XSDs in a relative  
way.  It seems (to me) that you can't make a catalog entry which  
overrides "../" to point to a specific place on the classpath.

For instance:
WSDL has <xsd:import schemaLocation="schemas/3rdPartySchema.xsd"/>
We map schemas to classpath:/schemas in a catalog and that works well.

then, in 3rdPartySchema.xsd there is a: <xsd:import schemaLocation="../ 
coreschemas/base.xsd"/>.  There seems no way to catalog "../" to point  
to classpath:/coreschemas...

What happens is anytime 3rdPartySchema.xsd makes reference to an  
element from base.xsd, it complains it's an unresolved element (but  
doesn't seem to complain that it can't find base.xsd mind you).

Craig.


On 16-Nov-09, at 7:25 AM, Daniel Kulp wrote:

>
> This is exactly what the XML catalogs are designed for (and the - 
> catalog flag
> on wsdl2java).     Basically, they allow URL patterns and such used  
> for
> imports to be mapped into new URL's where the stuff really lives.   
> Thus, you
> can have "http://..."  type URL's in the wsdl's/xsd's, but have  
> those remapped
> into file things or such.
>
> Dan
>
>
> On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
>> Hi there,
>>
>> I use WSDL2JAVAto generate client code from a WSDL. I'd like to  
>> store the
>> WSDL (and all referenced dependencies) locally so that the stubs  
>> can be
>> generated offline. However, the WSDL references (imports) other  
>> WSDLs as
>> well as schema files. These references are absolute URLs.
>>
>> Is it possible to map these URLs to local files somehow or do I  
>> have to
>> edit the WSDL manually and change to URLs so that they point to the  
>> local
>> files?
>>
>> Or is there a tool (wsdl2java itself?) that downloads everything  
>> needed for
>> codegeneration and changes the references so that they point to the  
>> local
>> copies of the files?
>>
>> Thanks for your answer,
>>
>> Dominik
>>
>
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog


Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Daniel Kulp <dk...@apache.org>.
On Mon November 16 2009 12:31:32 pm Daniel Kulp wrote:
> On Mon November 16 2009 12:15:51 pm Christian Schneider wrote:
> > Hi Dan,
> >
> > that is very interesting. Will this feature also work for the
> > wsdlLocation in the binding.xml ?
> > This would partly solve my problem with the issue of reading wsdls from
> > maven repos.
> 
> I don't think so.   The locations in the binding.xml are, per spec, I
>  think, system locations.     The catalogs are meant to map from public
>  locations to system locations.  Since the binding.xml things are already
>  system locations, I don't think they apply.

Actually, reading through the jaxws spec, I really don't see anything either 
way on the wsdlLocation thing.   Thus, we probably could interpret it either 
way and apply the catalog stuff.

That said, I'm not sure how it would solve your problem.  :-)   You still 
would need to get the ~/.m2/repository location thing into a catalog, right?  

Dan


> 
> Dan
> 
> > Greetings
> >
> > Christian
> >
> > Daniel Kulp schrieb:
> > > This is exactly what the XML catalogs are designed for (and the
> > > -catalog flag on wsdl2java).     Basically, they allow URL patterns and
> > > such used for imports to be mapped into new URL's where the stuff
> > > really lives. Thus, you can have "http://..."  type URL's in the
> > > wsdl's/xsd's, but have those remapped into file things or such.
> > >
> > > Dan
> > >
> > > On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
> > >> Hi there,
> > >>
> > >> I use WSDL2JAVAto generate client code from a WSDL. I'd like to store
> > >> the WSDL (and all referenced dependencies) locally so that the stubs
> > >> can be generated offline. However, the WSDL references (imports) other
> > >> WSDLs as well as schema files. These references are absolute URLs.
> > >>
> > >> Is it possible to map these URLs to local files somehow or do I have
> > >> to edit the WSDL manually and change to URLs so that they point to the
> > >> local files?
> > >>
> > >> Or is there a tool (wsdl2java itself?) that downloads everything
> > >> needed for codegeneration and changes the references so that they
> > >> point to the local copies of the files?
> > >>
> > >> Thanks for your answer,
> > >>
> > >> Dominik
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Daniel Kulp <dk...@apache.org>.
On Mon November 16 2009 12:15:51 pm Christian Schneider wrote:
> Hi Dan,
> 
> that is very interesting. Will this feature also work for the
> wsdlLocation in the binding.xml ?
> This would partly solve my problem with the issue of reading wsdls from
> maven repos.

I don't think so.   The locations in the binding.xml are, per spec, I think, 
system locations.     The catalogs are meant to map from public locations to 
system locations.  Since the binding.xml things are already system locations, 
I don't think they apply.   

Dan


> 
> Greetings
> 
> Christian
> 
> Daniel Kulp schrieb:
> > This is exactly what the XML catalogs are designed for (and the -catalog
> > flag on wsdl2java).     Basically, they allow URL patterns and such used
> > for imports to be mapped into new URL's where the stuff really lives. 
> > Thus, you can have "http://..."  type URL's in the wsdl's/xsd's, but have
> > those remapped into file things or such.
> >
> > Dan
> >
> > On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
> >> Hi there,
> >>
> >> I use WSDL2JAVAto generate client code from a WSDL. I'd like to store
> >> the WSDL (and all referenced dependencies) locally so that the stubs can
> >> be generated offline. However, the WSDL references (imports) other WSDLs
> >> as well as schema files. These references are absolute URLs.
> >>
> >> Is it possible to map these URLs to local files somehow or do I have to
> >>  edit the WSDL manually and change to URLs so that they point to the
> >> local files?
> >>
> >> Or is there a tool (wsdl2java itself?) that downloads everything needed
> >> for codegeneration and changes the references so that they point to the
> >> local copies of the files?
> >>
> >> Thanks for your answer,
> >>
> >> Dominik
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Dan,

that is very interesting. Will this feature also work for the 
wsdlLocation in the binding.xml ?
This would partly solve my problem with the issue of reading wsdls from 
maven repos.

Greetings

Christian


Daniel Kulp schrieb:
> This is exactly what the XML catalogs are designed for (and the -catalog flag 
> on wsdl2java).     Basically, they allow URL patterns and such used for 
> imports to be mapped into new URL's where the stuff really lives.  Thus, you 
> can have "http://..."  type URL's in the wsdl's/xsd's, but have those remapped 
> into file things or such.
>
> Dan
>
>
> On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
>   
>> Hi there,
>>
>> I use WSDL2JAVAto generate client code from a WSDL. I'd like to store the
>>  WSDL (and all referenced dependencies) locally so that the stubs can be
>>  generated offline. However, the WSDL references (imports) other WSDLs as
>>  well as schema files. These references are absolute URLs.
>>
>> Is it possible to map these URLs to local files somehow or do I have to
>>  edit the WSDL manually and change to URLs so that they point to the local
>>  files?
>>
>> Or is there a tool (wsdl2java itself?) that downloads everything needed for
>>  codegeneration and changes the references so that they point to the local
>>  copies of the files?
>>
>> Thanks for your answer,
>>
>> Dominik
>>
>>     
>
>   


-- 

Christian Schneider
---
http://www.liquid-reality.de


Re: WSDL2JAVA, store WSDLs and XSDs locally

Posted by Daniel Kulp <dk...@apache.org>.
This is exactly what the XML catalogs are designed for (and the -catalog flag 
on wsdl2java).     Basically, they allow URL patterns and such used for 
imports to be mapped into new URL's where the stuff really lives.  Thus, you 
can have "http://..."  type URL's in the wsdl's/xsd's, but have those remapped 
into file things or such.

Dan


On Sat November 14 2009 9:31:43 am Dominik Raymann wrote:
> Hi there,
> 
> I use WSDL2JAVAto generate client code from a WSDL. I'd like to store the
>  WSDL (and all referenced dependencies) locally so that the stubs can be
>  generated offline. However, the WSDL references (imports) other WSDLs as
>  well as schema files. These references are absolute URLs.
> 
> Is it possible to map these URLs to local files somehow or do I have to
>  edit the WSDL manually and change to URLs so that they point to the local
>  files?
> 
> Or is there a tool (wsdl2java itself?) that downloads everything needed for
>  codegeneration and changes the references so that they point to the local
>  copies of the files?
> 
> Thanks for your answer,
> 
> Dominik
> 

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog