You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Aaron Titus <at...@fwdco.com> on 2013/10/11 16:25:04 UTC

preventing unused types in wsdl

I am using CXF 2.7.6 and deploying bottom-up web service, using jax-ws
annotated classes. I have a half a dozen web services,  with 1 to 6
operations each.  I noticed that when viewing the WSDL for any one of the
services, that it always includes the type definitions for EVERY entity
class in the package, even the ones which are never referenced by the
specific service.

Is there any option to prevent this? In my situation it makes the WSDL very
large, and it also adds confusion to the developers who are the consumers
of the service -- most of them will be inexperienced with web services.

Thanks,
Aaron

Re: preventing unused types in wsdl

Posted by Aaron Titus <at...@fwdco.com>.
Hi Dan, so this is what I was afraid of.  It's not pulling the classes from
the actual service impl class but rather scanning the entire package.  Ugh.
 I cannot remove the object factory (at least I don't think I can) because
JAXB marshaling will break down.

I would like to look at the CXF code and try to determine the criteria
exactly for how its pulling in the types -- I would really like to find a
solution for this because most of the consumers of our API are using SOAP
typically with .NET, and when they import the WSDL it will create
duplicates of every type for each service, resulting in hundreds of
unnecessary duplicate classes.

If necessary I will consolidate everything to a single WSDL, but I'd really
like to avoid that if I can.




*Aaron Titus*
Senior Software Engineer
F.W. Davison & Company, Inc.
508-747-7261 x245
atitus@fwdco.com



On Mon, Oct 14, 2013 at 10:19 AM, Daniel Kulp <dk...@apache.org> wrote:

>
> On Oct 14, 2013, at 9:39 AM, Aaron Titus <at...@fwdco.com> wrote:
>
> > Hi Jason,  Thanks for the response, but this does not appear to work for
> > me, at least not in CXF 2.7.6.  I set this property but the WSDL still
> > includes every single jaxb class within the types section in the WSDL
> even
> > though my service doens't even reference them at all.
>
> If the classes are JAXB generated from schema, I don't think there is an
> easy way.   JAXB generates an ObjectFactory in the package which pretty
> much references everything.  If the ObjectFactory is found, that's used to
> grab the types and thus everything would be included.
>
> You MAY be able to delete the ObjectFactory and thus avoid that.  Not
> really sure.
>
> Dan
>
>
>
>
> >
> > *Aaron Titus*
> > Senior Software Engineer
> > F.W. Davison & Company, Inc.
> > 508-747-7261 x245
> > atitus@fwdco.com
> >
> >
> >
> > On Fri, Oct 11, 2013 at 7:13 PM, Jason Pell <ja...@pellcorp.com> wrote:
> >
> >> There is a parameter you can define to prevent this very thing.
> >>
> >> <jaxws:properties>
> >> <entry key="jaxb.scanPackages" value="false" />
> >> </jaxws:properties>
> >>
> >> See here for an example:
> >>
> >>
> >>
> https://github.com/pellcorp/cxf/blob/master/JavaFirst/src/main/resources/META-INF/scanPackagesContext.xml
> >>
> >> Sent from my Android phone
> >> On 12/10/2013 1:25 AM, "Aaron Titus" <at...@fwdco.com> wrote:
> >>
> >>> I am using CXF 2.7.6 and deploying bottom-up web service, using jax-ws
> >>> annotated classes. I have a half a dozen web services,  with 1 to 6
> >>> operations each.  I noticed that when viewing the WSDL for any one of
> the
> >>> services, that it always includes the type definitions for EVERY entity
> >>> class in the package, even the ones which are never referenced by the
> >>> specific service.
> >>>
> >>> Is there any option to prevent this? In my situation it makes the WSDL
> >> very
> >>> large, and it also adds confusion to the developers who are the
> consumers
> >>> of the service -- most of them will be inexperienced with web services.
> >>>
> >>> Thanks,
> >>> Aaron
> >>>
> >>
>
> --
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>
>

Re: preventing unused types in wsdl

Posted by Daniel Kulp <dk...@apache.org>.
On Oct 14, 2013, at 9:39 AM, Aaron Titus <at...@fwdco.com> wrote:

> Hi Jason,  Thanks for the response, but this does not appear to work for
> me, at least not in CXF 2.7.6.  I set this property but the WSDL still
> includes every single jaxb class within the types section in the WSDL even
> though my service doens't even reference them at all.

If the classes are JAXB generated from schema, I don't think there is an easy way.   JAXB generates an ObjectFactory in the package which pretty much references everything.  If the ObjectFactory is found, that's used to grab the types and thus everything would be included. 

You MAY be able to delete the ObjectFactory and thus avoid that.  Not really sure.   

Dan




> 
> *Aaron Titus*
> Senior Software Engineer
> F.W. Davison & Company, Inc.
> 508-747-7261 x245
> atitus@fwdco.com
> 
> 
> 
> On Fri, Oct 11, 2013 at 7:13 PM, Jason Pell <ja...@pellcorp.com> wrote:
> 
>> There is a parameter you can define to prevent this very thing.
>> 
>> <jaxws:properties>
>> <entry key="jaxb.scanPackages" value="false" />
>> </jaxws:properties>
>> 
>> See here for an example:
>> 
>> 
>> https://github.com/pellcorp/cxf/blob/master/JavaFirst/src/main/resources/META-INF/scanPackagesContext.xml
>> 
>> Sent from my Android phone
>> On 12/10/2013 1:25 AM, "Aaron Titus" <at...@fwdco.com> wrote:
>> 
>>> I am using CXF 2.7.6 and deploying bottom-up web service, using jax-ws
>>> annotated classes. I have a half a dozen web services,  with 1 to 6
>>> operations each.  I noticed that when viewing the WSDL for any one of the
>>> services, that it always includes the type definitions for EVERY entity
>>> class in the package, even the ones which are never referenced by the
>>> specific service.
>>> 
>>> Is there any option to prevent this? In my situation it makes the WSDL
>> very
>>> large, and it also adds confusion to the developers who are the consumers
>>> of the service -- most of them will be inexperienced with web services.
>>> 
>>> Thanks,
>>> Aaron
>>> 
>> 

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


Re: preventing unused types in wsdl

Posted by Aaron Titus <at...@fwdco.com>.
Hi Jason,  Thanks for the response, but this does not appear to work for
me, at least not in CXF 2.7.6.  I set this property but the WSDL still
includes every single jaxb class within the types section in the WSDL even
though my service doens't even reference them at all.




*Aaron Titus*
Senior Software Engineer
F.W. Davison & Company, Inc.
508-747-7261 x245
atitus@fwdco.com



On Fri, Oct 11, 2013 at 7:13 PM, Jason Pell <ja...@pellcorp.com> wrote:

> There is a parameter you can define to prevent this very thing.
>
> <jaxws:properties>
> <entry key="jaxb.scanPackages" value="false" />
> </jaxws:properties>
>
> See here for an example:
>
>
> https://github.com/pellcorp/cxf/blob/master/JavaFirst/src/main/resources/META-INF/scanPackagesContext.xml
>
> Sent from my Android phone
> On 12/10/2013 1:25 AM, "Aaron Titus" <at...@fwdco.com> wrote:
>
> > I am using CXF 2.7.6 and deploying bottom-up web service, using jax-ws
> > annotated classes. I have a half a dozen web services,  with 1 to 6
> > operations each.  I noticed that when viewing the WSDL for any one of the
> > services, that it always includes the type definitions for EVERY entity
> > class in the package, even the ones which are never referenced by the
> > specific service.
> >
> > Is there any option to prevent this? In my situation it makes the WSDL
> very
> > large, and it also adds confusion to the developers who are the consumers
> > of the service -- most of them will be inexperienced with web services.
> >
> > Thanks,
> > Aaron
> >
>

Re: preventing unused types in wsdl

Posted by Jason Pell <ja...@pellcorp.com>.
There is a parameter you can define to prevent this very thing.

<jaxws:properties>
<entry key="jaxb.scanPackages" value="false" />
</jaxws:properties>

See here for an example:

https://github.com/pellcorp/cxf/blob/master/JavaFirst/src/main/resources/META-INF/scanPackagesContext.xml

Sent from my Android phone
On 12/10/2013 1:25 AM, "Aaron Titus" <at...@fwdco.com> wrote:

> I am using CXF 2.7.6 and deploying bottom-up web service, using jax-ws
> annotated classes. I have a half a dozen web services,  with 1 to 6
> operations each.  I noticed that when viewing the WSDL for any one of the
> services, that it always includes the type definitions for EVERY entity
> class in the package, even the ones which are never referenced by the
> specific service.
>
> Is there any option to prevent this? In my situation it makes the WSDL very
> large, and it also adds confusion to the developers who are the consumers
> of the service -- most of them will be inexperienced with web services.
>
> Thanks,
> Aaron
>