Honestly, I don't think there's an easy way.   I just grepped through the 
JAX-WS spec and the JSR181 spec and neither spec mentions anything about 
it.   When we move to JAX-WS 2.1, we might be able to add support for 
@XmlElement(required=true).     Right now, we don't support any of the 
JAXB annotations on the SEI interface methods.   Some of those are 
required to be supported in jaxws 2.1.   XmlElement isn't one of those, 
but could potentially be added.

The only way to do it right now would be to create "wrapper" types and 
use the XmlElement annotation there and use the 
@RequestWrapper/@ResponseWrapper annotations to point to those types.   
That should then use those types to generate the schemas and thus the 
JAXB annotations should be honored.


Dan


On Friday 17 August 2007, Corey Puffalt wrote:
> Daniel,
>
> Thanks for your reply.
>
> I should have been more explicit.  I am using the default DOCUMENT
> style. Furthermore, I got my question completely backwards. :P  The
> real question (given that all non-primitive parameters are marked
> "minOccurs=0" as you mention below, how do I mark these parameters as
> being mandatory?  (eg. minOccurs=1?)
>
> Corey
>
> On 8/17/07, Daniel Kulp <[EMAIL PROTECTED]> wrote:
> > Corey,
> >
> > On Friday 17 August 2007, Corey Puffalt wrote:
> > > I'm doing Java-first development using CXF and JAX-WS annotations
> > > and I'm trying to figure out how to mark some of my method
> > > parameters as optional (nillable).  Does anyone know if this is
> > > possible?  It seems like a strange oversight so I'm guessing I'm
> > > just missing something obvious.
> >
> > It kind of depends on the form of the service.   I think with the
> > defaults (wrapped doc/lit), if the parameter is not a primitive, it
> > ends up with "minOccurs=0" on the element so you can send a null.
> >
> > For RPC/Lit, the WSI Basic Profile specifically prohibits sending
> > null parts with RCP/Lit:
> > R2211  An ENVELOPE described with an rpc-literal binding MUST NOT
> > have the xsi:nil attribute with a value of "1" or "true" on the part
> > accessors.
> >
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer
> > IONA
> > P: 781-902-8727    C: 508-380-7194
> > [EMAIL PROTECTED]
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to