You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "amer.almani" <am...@gmail.com> on 2010/12/09 02:20:14 UTC

wsdl2java & JAXB binding

Hello,

I have the case where I am building 4 web services. Each service exists in a
different project. I am using the wsdl2java maven codegen plugin. I defined
my model in a separate jar where i included all my POJOs. I generated my
model using jaxb after defining my schema. 

Now I am writing my wsdl files and I want to refer to my model in the
schema. For example, I have one web services that returns a Receipt object
as a result of an invocation. The same object is used by the invoking
service to supply as an argument for an invocation of a third web service.  

After generating my code using code-gen plugin. I noticed that each web
service is creating it is own Receipt class in its webapp. I don't want to
end up with three Receipt classes in three different packages!!

How can i write my wsdls, and define their schemas to point to my model?  


Amer
-- 
View this message in context: http://cxf.547215.n5.nabble.com/wsdl2java-JAXB-binding-tp3298341p3298341.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: wsdl2java & JAXB binding

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

If I understand correctly, your different wsdl files share some common  
type declared in the schema, if so, you can extract common types in a  
xsd files with other namespace, and your different wsdls just import  
common used xsd file, or you can put common types in another namespace  
schema embeded into your wsdl, wsdl2java tool has an option which  
allow your specify not generate some code with certain namespace,  
something like

-nexclude <schema-namespace [= java-package-name]>*
                      Specifies a WSDL namespace to exclude when  
generating code.
                      This option can be specified multiple times.  
Optionally
                      specify the Java package name to use for the WSDL
                      namespace.

So the key point here is that put common types in another namespace  
which in turn enable you get the chance that just exclude it when you  
generate code.

Hope this is what you want.

Freeman

On 2010-12-9, at 下午5:24, amer.almani wrote:

>
> Hi,
>
> Am using wsdl first approah. Every webservice exists in a different  
> project.
> My model is collection  of classes that are shared between the  
> services.
> Every webservice will import the model to define its interfaces.
>
> What I want to do is somehow import my model schema to each wsdl  
> file, and
> avoid having the plugin generate new classes for my model for each  
> service
> package.
>
> Amer
>
> -- 
> View this message in context: http://cxf.547215.n5.nabble.com/wsdl2java-JAXB-binding-tp3298341p3298609.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
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: wsdl2java & JAXB binding

Posted by "amer.almani" <am...@gmail.com>.
Hi,

Am using wsdl first approah. Every webservice exists in a different project.
My model is collection  of classes that are shared between the services.
Every webservice will import the model to define its interfaces. 

What I want to do is somehow import my model schema to each wsdl file, and
avoid having the plugin generate new classes for my model for each service
package.

Amer

-- 
View this message in context: http://cxf.547215.n5.nabble.com/wsdl2java-JAXB-binding-tp3298341p3298609.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: wsdl2java & JAXB binding

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


On 2010-12-9, at 上午9:20, amer.almani wrote:

>
> Hello,
>
> I have the case where I am building 4 web services. Each service  
> exists in a
> different project. I am using the wsdl2java maven codegen plugin. I  
> defined
> my model in a separate jar where i included all my POJOs. I  
> generated my
> model using jaxb after defining my schema.
I'm not sure I understand your approach, you're using wsdl first way  
or code first way?
What "model" here you mean?
>
> Now I am writing my wsdl files and I want to refer to my model in the
> schema. For example, I have one web services that returns a Receipt  
> object
> as a result of an invocation. The same object is used by the invoking
> service to supply as an argument for an invocation of a third web  
> service.
>
> After generating my code using code-gen plugin. I noticed that each  
> web
> service is creating it is own Receipt class in its webapp. I don't  
> want to
> end up with three Receipt classes in three different packages!!
Generally if the namespace of your schema is same, then same class  
should be generated into same package.

Freeman

>
> How can i write my wsdls, and define their schemas to point to my  
> model?
>
>
> Amer
> -- 
> View this message in context: http://cxf.547215.n5.nabble.com/wsdl2java-JAXB-binding-tp3298341p3298341.html
> Sent from the cxf-user mailing list archive at Nabble.com.


-- 
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