You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by James Mao <ja...@iona.com> on 2006/11/16 12:08:39 UTC

Re: Importing schemas from jars

Resend this email, sorry if you received twice.

Hi Robin,

We only fixed this in the wsdl2java tools, I don't know how the jaxb xjc 
resolve the resources, i have to ask a question in the jaxb mail list.

The xjc catalog works only in jaxb example which use the the xjc ant 
task, i tried to use in maven2 xjc plugin, seems not work properly , i 
have to ask this also in jaxb mail list.

The work-around solution i have is to create another maven plugin, the 
plugin will read the xsd and turns out the dumy wsdl file which only 
contain the schema, and then use the wsdl2java to generate the xsd java 
types artifacts.

I mean if it's urgent for you, i can do this for a tempo solution.

BTW, the catalog is also a work-around solution for you, right? you are 
not going to use catalog in the real system, right?

Cheers,
James.

> Hello,
>
> I would like to use the xsdtojava maven plugin to generate code for a
> schema that references a schema in the cxf-common-schemas jar.
>
> I tried adding a dependency to cxf-common-schemas and using the
> following import:
>
>     <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
>                schemaLocation="/schemas/wsdl/wsdl.xsd"/>
>
> However, xjc is unable to resolve "/schemas/wsdl/wsdl.xsd".  I also
> tried using the "-catalog" option without any luck (it doesn't seem to
> search the classpath for resources either).
>
> Any suggestions?
>
>
> Thanks,
> Robin
>
>   


Re: Importing schemas from jars

Posted by Robin Luscombe <Ro...@iona.com>.
Hello Jim,

On Thu, Nov 16, 2006 at 07:27:12PM +0800, Jim Ma wrote:
> Hi Robin ,
> 
> I tried http.xsd  using the "-catalog" option . It works fine.
> 
> XJC seems do not invoke catalog resolver if the schemaLoacation defined with
> relative path like   " /schemas/wsdl/wsdl.xsd",
> 
> so I need to change the schemaLocation as following :
> 
>   <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
>              schemaLocation="http://schemas/wsdl/a.xsd"/>
> 
> And this is my catalog file :
> 
> <!DOCTYPE catalog
>  PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
>  "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
>          prefer="public">
> <rewriteSystem
>         systemIdStartString="http://schemas/wsdl/a.xsd"
>         rewritePrefix="jar:file:/mavenrepo/org/apache/cxf/cxf-common-schemas
> /2.0-incubator-M1-SNAPSHOT/cxf-common-schemas-2.0-incubator-M1-SNAPSHOT.jar!
> /schemas/wsdl/wsdl.xsd" />
> </catalog>

In my case, the location of the jar cannot be present in the catalog
since it is variable.  Is there a way for the catalog resolver to pick
the jar up from the classpath?  Also, this would create a maintenance
problem since all catalogs would have to be updated when switching to a
new version of cxf-common-schemas.  Is there a way to do it without
specifying the version?

The best solution would be to specify "/schemas/wsdl/wsdl.xsd" and have
the catalog resolver search the classpath.  Is there a way to do this?


Thanks,
Robin

Re: Importing schemas from jars

Posted by Robin Luscombe <Ro...@iona.com>.
Hello Jim,

On Thu, Nov 16, 2006 at 07:27:12PM +0800, Jim Ma wrote:
> Hi Robin ,
> 
> I tried http.xsd  using the "-catalog" option . It works fine.
> 
> XJC seems do not invoke catalog resolver if the schemaLoacation defined with
> relative path like   " /schemas/wsdl/wsdl.xsd",
> 
> so I need to change the schemaLocation as following :
> 
>   <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
>              schemaLocation="http://schemas/wsdl/a.xsd"/>
> 
> And this is my catalog file :
> 
> <!DOCTYPE catalog
>  PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
>  "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
>          prefer="public">
> <rewriteSystem
>         systemIdStartString="http://schemas/wsdl/a.xsd"
>         rewritePrefix="jar:file:/mavenrepo/org/apache/cxf/cxf-common-schemas
> /2.0-incubator-M1-SNAPSHOT/cxf-common-schemas-2.0-incubator-M1-SNAPSHOT.jar!
> /schemas/wsdl/wsdl.xsd" />
> </catalog>

In my case, the location of the jar cannot be present in the catalog
since it is variable.  Is there a way for the catalog resolver to pick
the jar up from the classpath?  Also, this would create a maintenance
problem since all catalogs would have to be updated when switching to a
new version of cxf-common-schemas.  Is there a way to do it without
specifying the version?

The best solution would be to specify "/schemas/wsdl/wsdl.xsd" and have
the catalog resolver search the classpath.  Is there a way to do this?


Thanks,
Robin

Re: Importing schemas from jars

Posted by James Mao <ja...@iona.com>.
Hi Robin,
> Lets consider the WS-Resource Framework (WSRF) set of schemas.  The goal
> is to generated the Java code without requiring network access and
> without modifying the schemas.  An XML catalog can be used to map the
> WSRF schema locations to local files.  However, the WSRF schemas depend
> on the xml namespace and ws-addressing schemas.  The XML catalog can be
> used to map the locations of these schemas to local files, but this
> would require the copying of schemas that are available in the
> cxf-common-schema jar.  It would be cleaner if the catalog could map
> schema locations to classpath resources.
>   
That make sense to me.
That's another question i will ask in the JAXB mail list.

Cheers,
James.


Re: Importing schemas from jars

Posted by James Mao <ja...@iona.com>.
Hi Robin,
> Lets consider the WS-Resource Framework (WSRF) set of schemas.  The goal
> is to generated the Java code without requiring network access and
> without modifying the schemas.  An XML catalog can be used to map the
> WSRF schema locations to local files.  However, the WSRF schemas depend
> on the xml namespace and ws-addressing schemas.  The XML catalog can be
> used to map the locations of these schemas to local files, but this
> would require the copying of schemas that are available in the
> cxf-common-schema jar.  It would be cleaner if the catalog could map
> schema locations to classpath resources.
>   
That make sense to me.
That's another question i will ask in the JAXB mail list.

Cheers,
James.


Re: Importing schemas from jars

Posted by Robin Luscombe <Ro...@iona.com>.
Hello James,

On Thu, Nov 16, 2006 at 10:55:17PM +0800, James Mao wrote:
> Hi Robin,
> 
> OK, I thought what you need is to resolve the schemaLocation in the 
> classpath.
> e.g:
> 
> <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
> 	       schemaLocation="/schemas/wsdl/wsdl.xsd"/>
> 
> resolve the wsdl.xsd from the classpath

Yes, this is an issue for me.

> I have already  sent a mail to the jaxb, if there's response, i'll send 
> the response in this mail list.

That would be great.

> If that works, you don't need the catalog, right?

This is a separate, but related issue.

Lets consider the WS-Resource Framework (WSRF) set of schemas.  The goal
is to generated the Java code without requiring network access and
without modifying the schemas.  An XML catalog can be used to map the
WSRF schema locations to local files.  However, the WSRF schemas depend
on the xml namespace and ws-addressing schemas.  The XML catalog can be
used to map the locations of these schemas to local files, but this
would require the copying of schemas that are available in the
cxf-common-schema jar.  It would be cleaner if the catalog could map
schema locations to classpath resources.

Cheers,
Robin

Re: Importing schemas from jars

Posted by Robin Luscombe <Ro...@iona.com>.
Hello James,

On Thu, Nov 16, 2006 at 10:55:17PM +0800, James Mao wrote:
> Hi Robin,
> 
> OK, I thought what you need is to resolve the schemaLocation in the 
> classpath.
> e.g:
> 
> <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
> 	       schemaLocation="/schemas/wsdl/wsdl.xsd"/>
> 
> resolve the wsdl.xsd from the classpath

Yes, this is an issue for me.

> I have already  sent a mail to the jaxb, if there's response, i'll send 
> the response in this mail list.

That would be great.

> If that works, you don't need the catalog, right?

This is a separate, but related issue.

Lets consider the WS-Resource Framework (WSRF) set of schemas.  The goal
is to generated the Java code without requiring network access and
without modifying the schemas.  An XML catalog can be used to map the
WSRF schema locations to local files.  However, the WSRF schemas depend
on the xml namespace and ws-addressing schemas.  The XML catalog can be
used to map the locations of these schemas to local files, but this
would require the copying of schemas that are available in the
cxf-common-schema jar.  It would be cleaner if the catalog could map
schema locations to classpath resources.

Cheers,
Robin

Re: Importing schemas from jars

Posted by James Mao <ja...@iona.com>.
Hi Robin,

OK, I thought what you need is to resolve the schemaLocation in the 
classpath.
e.g:

<xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
	       schemaLocation="/schemas/wsdl/wsdl.xsd"/>

resolve the wsdl.xsd from the classpath

I have already  sent a mail to the jaxb, if there's response, i'll send 
the response in this mail list.
If that works, you don't need the catalog, right?

According to catalog, I agree though, it's a useful feature.

> Hello James,
>
> On Thu, Nov 16, 2006 at 07:08:39PM +0800, James Mao wrote:
> [...]
>   
>> BTW, the catalog is also a work-around solution for you, right? you are 
>> not going to use catalog in the real system, right?
>>     
>
> Using a catalog seems to make sense in a lot of situations.  For
> example, schemas can use the following import:
>
>     <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
> 	       schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>
>
> A catalog can then be used to point to a local copy of wsdl.xsd.  Or
> even better, the wsdl.xsd from the cxf-common-schemas jar.
>
> It also allows the use of 3rd-party schemas with imports without
> modification.
>
> Cheers,
> Robin
>
>   


Re: Importing schemas from jars

Posted by James Mao <ja...@iona.com>.
Hi Robin,

OK, I thought what you need is to resolve the schemaLocation in the 
classpath.
e.g:

<xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
	       schemaLocation="/schemas/wsdl/wsdl.xsd"/>

resolve the wsdl.xsd from the classpath

I have already  sent a mail to the jaxb, if there's response, i'll send 
the response in this mail list.
If that works, you don't need the catalog, right?

According to catalog, I agree though, it's a useful feature.

> Hello James,
>
> On Thu, Nov 16, 2006 at 07:08:39PM +0800, James Mao wrote:
> [...]
>   
>> BTW, the catalog is also a work-around solution for you, right? you are 
>> not going to use catalog in the real system, right?
>>     
>
> Using a catalog seems to make sense in a lot of situations.  For
> example, schemas can use the following import:
>
>     <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
> 	       schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>
>
> A catalog can then be used to point to a local copy of wsdl.xsd.  Or
> even better, the wsdl.xsd from the cxf-common-schemas jar.
>
> It also allows the use of 3rd-party schemas with imports without
> modification.
>
> Cheers,
> Robin
>
>   


Re: Importing schemas from jars

Posted by Sergey Beryozkin <se...@iona.com>.
> Using a catalog seems to make sense in a lot of situations.  For
> example, schemas can use the following import:
> 
>    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
>        schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>
> 
> A catalog can then be used to point to a local copy of wsdl.xsd.  Or
> even better, the wsdl.xsd from the cxf-common-schemas jar.
> 
> It also allows the use of 3rd-party schemas with imports without
> modification.

+1

Cheers, Sergey


Re: Importing schemas from jars

Posted by Sergey Beryozkin <se...@iona.com>.
> Using a catalog seems to make sense in a lot of situations.  For
> example, schemas can use the following import:
> 
>    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
>        schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>
> 
> A catalog can then be used to point to a local copy of wsdl.xsd.  Or
> even better, the wsdl.xsd from the cxf-common-schemas jar.
> 
> It also allows the use of 3rd-party schemas with imports without
> modification.

+1

Cheers, Sergey


Re: Importing schemas from jars

Posted by Robin Luscombe <Ro...@iona.com>.
Hello James,

On Thu, Nov 16, 2006 at 07:08:39PM +0800, James Mao wrote:
[...]
> 
> BTW, the catalog is also a work-around solution for you, right? you are 
> not going to use catalog in the real system, right?

Using a catalog seems to make sense in a lot of situations.  For
example, schemas can use the following import:

    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
	       schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>

A catalog can then be used to point to a local copy of wsdl.xsd.  Or
even better, the wsdl.xsd from the cxf-common-schemas jar.

It also allows the use of 3rd-party schemas with imports without
modification.

Cheers,
Robin

Re: Importing schemas from jars

Posted by Robin Luscombe <Ro...@iona.com>.
Hello James,

On Thu, Nov 16, 2006 at 07:08:39PM +0800, James Mao wrote:
[...]
> 
> BTW, the catalog is also a work-around solution for you, right? you are 
> not going to use catalog in the real system, right?

Using a catalog seems to make sense in a lot of situations.  For
example, schemas can use the following import:

    <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
	       schemaLocation="http://schemas.xmlsoap.org/wsdl/"/>

A catalog can then be used to point to a local copy of wsdl.xsd.  Or
even better, the wsdl.xsd from the cxf-common-schemas jar.

It also allows the use of 3rd-party schemas with imports without
modification.

Cheers,
Robin

RE: Importing schemas from jars

Posted by Jim Ma <ji...@iona.com>.
Hi Robin ,

I tried http.xsd  using the "-catalog" option . It works fine.

XJC seems do not invoke catalog resolver if the schemaLoacation defined with
relative path like   " /schemas/wsdl/wsdl.xsd",

so I need to change the schemaLocation as following :

  <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
             schemaLocation="http://schemas/wsdl/a.xsd"/>

And this is my catalog file :

<!DOCTYPE catalog
 PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
 "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
         prefer="public">
<rewriteSystem
        systemIdStartString="http://schemas/wsdl/a.xsd"
        rewritePrefix="jar:file:/mavenrepo/org/apache/cxf/cxf-common-schemas
/2.0-incubator-M1-SNAPSHOT/cxf-common-schemas-2.0-incubator-M1-SNAPSHOT.jar!
/schemas/wsdl/wsdl.xsd" />
</catalog>

Regards

Jim


> -----Original Message-----
> From: James Mao [mailto:james.mao@iona.com]
> Sent: Thursday, November 16, 2006 7:09 PM
> To: cxf-user@incubator.apache.org; cxf-dev@incubator.apache.org
> Subject: Re: Importing schemas from jars
>
>
> Resend this email, sorry if you received twice.
>
> Hi Robin,
>
> We only fixed this in the wsdl2java tools, I don't know how the jaxb xjc
> resolve the resources, i have to ask a question in the jaxb mail list.
>
> The xjc catalog works only in jaxb example which use the the xjc ant
> task, i tried to use in maven2 xjc plugin, seems not work properly , i
> have to ask this also in jaxb mail list.
>
> The work-around solution i have is to create another maven plugin, the
> plugin will read the xsd and turns out the dumy wsdl file which only
> contain the schema, and then use the wsdl2java to generate the xsd java
> types artifacts.
>
> I mean if it's urgent for you, i can do this for a tempo solution.
>
> BTW, the catalog is also a work-around solution for you, right? you are
> not going to use catalog in the real system, right?
>
> Cheers,
> James.
>
> > Hello,
> >
> > I would like to use the xsdtojava maven plugin to generate code for a
> > schema that references a schema in the cxf-common-schemas jar.
> >
> > I tried adding a dependency to cxf-common-schemas and using the
> > following import:
> >
> >     <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
> >                schemaLocation="/schemas/wsdl/wsdl.xsd"/>
> >
> > However, xjc is unable to resolve "/schemas/wsdl/wsdl.xsd".  I also
> > tried using the "-catalog" option without any luck (it doesn't seem to
> > search the classpath for resources either).
> >
> > Any suggestions?
> >
> >
> > Thanks,
> > Robin
> >
> >
>


RE: Importing schemas from jars

Posted by Jim Ma <ji...@iona.com>.
Hi Robin ,

I tried http.xsd  using the "-catalog" option . It works fine.

XJC seems do not invoke catalog resolver if the schemaLoacation defined with
relative path like   " /schemas/wsdl/wsdl.xsd",

so I need to change the schemaLocation as following :

  <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
             schemaLocation="http://schemas/wsdl/a.xsd"/>

And this is my catalog file :

<!DOCTYPE catalog
 PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
 "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
         prefer="public">
<rewriteSystem
        systemIdStartString="http://schemas/wsdl/a.xsd"
        rewritePrefix="jar:file:/mavenrepo/org/apache/cxf/cxf-common-schemas
/2.0-incubator-M1-SNAPSHOT/cxf-common-schemas-2.0-incubator-M1-SNAPSHOT.jar!
/schemas/wsdl/wsdl.xsd" />
</catalog>

Regards

Jim


> -----Original Message-----
> From: James Mao [mailto:james.mao@iona.com]
> Sent: Thursday, November 16, 2006 7:09 PM
> To: cxf-user@incubator.apache.org; cxf-dev@incubator.apache.org
> Subject: Re: Importing schemas from jars
>
>
> Resend this email, sorry if you received twice.
>
> Hi Robin,
>
> We only fixed this in the wsdl2java tools, I don't know how the jaxb xjc
> resolve the resources, i have to ask a question in the jaxb mail list.
>
> The xjc catalog works only in jaxb example which use the the xjc ant
> task, i tried to use in maven2 xjc plugin, seems not work properly , i
> have to ask this also in jaxb mail list.
>
> The work-around solution i have is to create another maven plugin, the
> plugin will read the xsd and turns out the dumy wsdl file which only
> contain the schema, and then use the wsdl2java to generate the xsd java
> types artifacts.
>
> I mean if it's urgent for you, i can do this for a tempo solution.
>
> BTW, the catalog is also a work-around solution for you, right? you are
> not going to use catalog in the real system, right?
>
> Cheers,
> James.
>
> > Hello,
> >
> > I would like to use the xsdtojava maven plugin to generate code for a
> > schema that references a schema in the cxf-common-schemas jar.
> >
> > I tried adding a dependency to cxf-common-schemas and using the
> > following import:
> >
> >     <xs:import namespace="http://schemas.xmlsoap.org/wsdl/"
> >                schemaLocation="/schemas/wsdl/wsdl.xsd"/>
> >
> > However, xjc is unable to resolve "/schemas/wsdl/wsdl.xsd".  I also
> > tried using the "-catalog" option without any luck (it doesn't seem to
> > search the classpath for resources either).
> >
> > Any suggestions?
> >
> >
> > Thanks,
> > Robin
> >
> >
>