You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sonam Nepali <So...@imail.org> on 2011/03/01 00:15:13 UTC

Package specification using Maven plugin for CXF

Hi

I am trying to generate Java artifacts from a WSDL using cxf-codegen-plugin with a specific package-name for the WSDL.  When I give the following option in my pom.xml,

..<plugin>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-codegen-plugin</artifactId>
      <version>${cxf.version}</version>
      <executions>
            <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
<wsdlOptions>
                  <wsdlOption>
                        <wsdl>${basedir}/src/main/resources/META-INF/MyWsdl.wsdl</wsdl>
                        <packagenames>
                              <packagename>a.b.c.service</packagename>
                        </packagenames>
                  </wsdlOption>


It is generating the Java artifacts in one 'a.b.c.service' package for the WSDL and also for the schema (XSD) files that are referenced within the WSDL.  Is there a way to just generate the Java artifacts for the 'MyWsdl.wsdl' in 'a.b.c.service' package and the rest referenced(XSD) in the WSDL in their own default package?

Thanks

Sonam Nepali


Re: Package specification using Maven plugin for CXF

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Are the wsdl and referenced xsd using same target namespace?
If so, generated code with same specified package  name is expected  
behavior.
If not, IMO it's a bug.

Freeman
On 2011-3-1, at 上午7:15, Sonam Nepali wrote:

> Hi
>
> I am trying to generate Java artifacts from a WSDL using cxf-codegen- 
> plugin with a specific package-name for the WSDL.  When I give the  
> following option in my pom.xml,
>
> ..<plugin>
>      <groupId>org.apache.cxf</groupId>
>      <artifactId>cxf-codegen-plugin</artifactId>
>      <version>${cxf.version}</version>
>      <executions>
>            <execution>
>            <id>generate-sources</id>
>            <phase>generate-sources</phase>
>            <configuration>
> <wsdlOptions>
>                  <wsdlOption>
>                        <wsdl>${basedir}/src/main/resources/META-INF/ 
> MyWsdl.wsdl</wsdl>
>                        <packagenames>
>                              <packagename>a.b.c.service</packagename>
>                        </packagenames>
>                  </wsdlOption>
>
>
> It is generating the Java artifacts in one 'a.b.c.service' package  
> for the WSDL and also for the schema (XSD) files that are referenced  
> within the WSDL.  Is there a way to just generate the Java artifacts  
> for the 'MyWsdl.wsdl' in 'a.b.c.service' package and the rest  
> referenced(XSD) in the WSDL in their own default package?
>
> Thanks
>
> Sonam Nepali
>


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org


Re: Package specification using Maven plugin for CXF

Posted by Daniel Kulp <dk...@apache.org>.
As Freeman mentioned, if they are both in the same namespace, there isn't 
anything to do from Maven.   They would both always be mapped to the same 
package.

If they are in separate namespaces, you can use:

<packagename>http://my.name.space.com=a.b.c.service</packagename>

to map individual namespaces to different pacakges.

Outside of maven, you could create a JAX-WS binding file that would map just 
the wsdl parts to a particular namespace.   That should also work.

Dan


On Monday 28 February 2011 6:15:13 PM Sonam Nepali wrote:
> Hi
> 
> I am trying to generate Java artifacts from a WSDL using cxf-codegen-plugin
> with a specific package-name for the WSDL.  When I give the following
> option in my pom.xml,
> 
> ..<plugin>
>       <groupId>org.apache.cxf</groupId>
>       <artifactId>cxf-codegen-plugin</artifactId>
>       <version>${cxf.version}</version>
>       <executions>
>             <execution>
>             <id>generate-sources</id>
>             <phase>generate-sources</phase>
>             <configuration>
> <wsdlOptions>
>                   <wsdlOption>
>                        
> <wsdl>${basedir}/src/main/resources/META-INF/MyWsdl.wsdl</wsdl>
> <packagenames>
>                               <packagename>a.b.c.service</packagename>
>                         </packagenames>
>                   </wsdlOption>
> 
> 
> It is generating the Java artifacts in one 'a.b.c.service' package for the
> WSDL and also for the schema (XSD) files that are referenced within the
> WSDL.  Is there a way to just generate the Java artifacts for the
> 'MyWsdl.wsdl' in 'a.b.c.service' package and the rest referenced(XSD) in
> the WSDL in their own default package?
> 
> Thanks
> 
> Sonam Nepali

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