You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by tbee <tb...@tbee.org> on 2010/03/05 14:13:31 UTC

Configuring minOccurs on JAXB binding

This has been discussed before and I found out that it is not possible using
JAXB until some future release of CXF and JAXB. But there is a workaround by
overriding the getWrapperPartMinOccurs method:

public class ServiceConfiguration extends
org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
{
	@Override public long getWrapperPartMinOccurs(MessagePartInfo mpi)
	{
		return 1l;
	}
}

This works fine. But the problem is that I do not ALWAYS want to have
minOccurs = 1. So I need a way to specify  this. Somehow I need to add
something to the parameters in the interface that defines the web service,
and be able to retrieve that via the MessagePartInfo parameter. One of these
methods seem to provide possible hooks:

mpi.getMessageInfo()
mpi.getXmlSchema()
mpi.getExtensionAttributes()

or maybe even

mpi.getName()

Any suggestions on how to get info from the interface to the method?

-- 
View this message in context: http://old.nabble.com/Configuring-minOccurs-on-JAXB-binding-tp27793701p27793701.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Configuring minOccurs on JAXB binding

Posted by Daniel Kulp <dk...@apache.org>.
I THINK from the MPI, you can traverse up a bit
mpi.getMessageInfo().getOperation().

The OperationInfo may then have the raw Method object on it:

Method m = (Method)op.getProperty("operation.method")
from which you could pull any info you want.   You could actually define your 
own annotation or something and look for it.

Dan


On Friday 05 March 2010 8:13:31 am tbee wrote:
> This has been discussed before and I found out that it is not possible
> using JAXB until some future release of CXF and JAXB. But there is a
> workaround by overriding the getWrapperPartMinOccurs method:
> 
> public class ServiceConfiguration extends
> org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
> {
> 	@Override public long getWrapperPartMinOccurs(MessagePartInfo mpi)
> 	{
> 		return 1l;
> 	}
> }
> 
> This works fine. But the problem is that I do not ALWAYS want to have
> minOccurs = 1. So I need a way to specify  this. Somehow I need to add
> something to the parameters in the interface that defines the web service,
> and be able to retrieve that via the MessagePartInfo parameter. One of
> these methods seem to provide possible hooks:
> 
> mpi.getMessageInfo()
> mpi.getXmlSchema()
> mpi.getExtensionAttributes()
> 
> or maybe even
> 
> mpi.getName()
> 
> Any suggestions on how to get info from the interface to the method?

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