You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by DSL <dl...@gmail.com> on 2007/09/19 16:44:08 UTC

cxf-codegen-plugin and catalogs

Hello,

I am trying to reference another project that contains xjc generated
code from xsd file. When I run the plugin in cxf, it does not seem to
be working as I am expecting.

I am trying to use a catalog:

<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">

  <!-- Tried this one first without success -->
  <rewriteSystem systemIdStartString="dcterms.xsd"
rewritePrefix="classpath:/dcterms.xsd"/>
  <rewriteSystem systemIdStartString="dc.xsd"
rewritePrefix="classpath:/dc.xsd"/>
  <rewriteSystem systemIdStartString="dcmitype.xsd"
rewritePrefix="classpath:/dcmitype.xsd"/>

  <!-- Added second didn't work either -->
  <rewriteURI uriStartString="dcterms.xsd"
rewritePrefix="classpath:/dcterms.xsd"/>
  <rewriteURI uriStartString="dc.xsd" rewritePrefix="classpath:/dc.xsd"/>
  <rewriteURI uriStartString="dcmitype.xsd"
rewritePrefix="classpath:/dcmitype.xsd"/>

</catalog>

to replace the imports in my imported xsd file:

 <xs:import namespace="http://purl.org/dc/elements/1.1/"
schemaLocation="cdc.xsd"/>

  <xs:import namespace="http://purl.org/dc/terms/"
schemaLocation="cdcterm.xsd"/>

  <xs:import namespace="http://purl.org/dc/dcmitype/"
schemaLocation="dcmitype.xsd"/>

Here is the hiearchy:

My WSDL imports and xml schema file (XSD) that contains the above imports.

Here is my plugin code:

<plugin>
	<groupId>org.apache.cxf</groupId>
	<artifactId>cxf-codegen-plugin</artifactId>
	<version>2.1-incubator-SNAPSHOT</version>
	<executions>
		<execution>
			<id>generate-sources</id>
			<phase>generate-sources</phase>
			<configuration>
				<sourceRoot>
					${basedir}/target/generated-sources/src/main/java
				</sourceRoot>
				<wsdlOptions>
					<wsdlOption>
						<wsdl>
							${basedir}/src/main/resources/contentservice.wsdl
						</wsdl>
						<extraargs>
							<extraarg>-verbose</extraarg>
                                                       <!-- Use
catalog to tell codegen to look on classpath for those xsd files -->
							<extraarg>-catalog</extraarg>
							<extraarg>${basedir}/catalog.xml</extraarg>
                                                       <!-- Do not
generate these since already generated in another project -->
							<extraarg>-nexclude</extraarg>
							<extraarg>http://purl.org/dc/elements/1.1/</extraarg>
							<extraarg>-nexclude</extraarg>
							<extraarg>http://purl.org/dc/dcmitype/</extraarg>
							<extraarg>-nexclude</extraarg>
							<extraarg>http://purl.org/dc/terms/</extraarg>
						</extraargs>
					</wsdlOption>
				</wsdlOptions>
			</configuration>
			<goals>
				<goal>wsdl2java</goal>
			</goals>
		</execution>
	</executions>
</plugin>

Maybe I am going about this all wrong, My first time with xml
catalogs. Can this even be done? Can the code generator see the xsds
that exist in the dependency jars?

All help is appreciated.

Daniel

Re: cxf-codegen-plugin and catalogs

Posted by James Mao <ja...@iona.com>.
I suggest you to work with command line tools first, and try a simple case,
and also there's test under the tools, if you have the source code, just 
grep the 'catalog'

James

> Hello,
>
> I am trying to reference another project that contains xjc generated
> code from xsd file. When I run the plugin in cxf, it does not seem to
> be working as I am expecting.
>
> I am trying to use a catalog:
>
> <?xml version="1.0"?>
> <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="public">
>
>   <!-- Tried this one first without success -->
>   <rewriteSystem systemIdStartString="dcterms.xsd"
> rewritePrefix="classpath:/dcterms.xsd"/>
>   <rewriteSystem systemIdStartString="dc.xsd"
> rewritePrefix="classpath:/dc.xsd"/>
>   <rewriteSystem systemIdStartString="dcmitype.xsd"
> rewritePrefix="classpath:/dcmitype.xsd"/>
>
>   <!-- Added second didn't work either -->
>   <rewriteURI uriStartString="dcterms.xsd"
> rewritePrefix="classpath:/dcterms.xsd"/>
>   <rewriteURI uriStartString="dc.xsd" rewritePrefix="classpath:/dc.xsd"/>
>   <rewriteURI uriStartString="dcmitype.xsd"
> rewritePrefix="classpath:/dcmitype.xsd"/>
>
> </catalog>
>
> to replace the imports in my imported xsd file:
>
>  <xs:import namespace="http://purl.org/dc/elements/1.1/"
> schemaLocation="cdc.xsd"/>
>
>   <xs:import namespace="http://purl.org/dc/terms/"
> schemaLocation="cdcterm.xsd"/>
>
>   <xs:import namespace="http://purl.org/dc/dcmitype/"
> schemaLocation="dcmitype.xsd"/>
>
> Here is the hiearchy:
>
> My WSDL imports and xml schema file (XSD) that contains the above imports.
>
> Here is my plugin code:
>
> <plugin>
> 	<groupId>org.apache.cxf</groupId>
> 	<artifactId>cxf-codegen-plugin</artifactId>
> 	<version>2.1-incubator-SNAPSHOT</version>
> 	<executions>
> 		<execution>
> 			<id>generate-sources</id>
> 			<phase>generate-sources</phase>
> 			<configuration>
> 				<sourceRoot>
> 					${basedir}/target/generated-sources/src/main/java
> 				</sourceRoot>
> 				<wsdlOptions>
> 					<wsdlOption>
> 						<wsdl>
> 							${basedir}/src/main/resources/contentservice.wsdl
> 						</wsdl>
> 						<extraargs>
> 							<extraarg>-verbose</extraarg>
>                                                        <!-- Use
> catalog to tell codegen to look on classpath for those xsd files -->
> 							<extraarg>-catalog</extraarg>
> 							<extraarg>${basedir}/catalog.xml</extraarg>
>                                                        <!-- Do not
> generate these since already generated in another project -->
> 							<extraarg>-nexclude</extraarg>
> 							<extraarg>http://purl.org/dc/elements/1.1/</extraarg>
> 							<extraarg>-nexclude</extraarg>
> 							<extraarg>http://purl.org/dc/dcmitype/</extraarg>
> 							<extraarg>-nexclude</extraarg>
> 							<extraarg>http://purl.org/dc/terms/</extraarg>
> 						</extraargs>
> 					</wsdlOption>
> 				</wsdlOptions>
> 			</configuration>
> 			<goals>
> 				<goal>wsdl2java</goal>
> 			</goals>
> 		</execution>
> 	</executions>
> </plugin>
>
> Maybe I am going about this all wrong, My first time with xml
> catalogs. Can this even be done? Can the code generator see the xsds
> that exist in the dependency jars?
>
> All help is appreciated.
>
> Daniel
>
>