Unfortunately, this is completely per spec and there isn't any way to control this right now. If you are interested in rolling your own version of cxf, the line that would need to be modified is line 1153 of the ReflectionServiceFactoryBean:

if (mpi.getTypeClass() != null && ! mpi.getTypeClass().isPrimitive()) {
                        el.setMinOccurs(0);
                    }

If you want to go the javabean route, you can run the java2ws - wrapperbeans tool to have it generate the wrapper beans for you to use as a starting point. Definitely not ideal though.


Dan


On Jul 10, 2008, at 9:33 AM, Wojtek212 wrote:


Hi,
Is there any way to force that minOccurs=1 instead of minOccurs=0 in wsdl? Unfortunately @WebParam annotation doesn't contain "required" attribute.

I'm using CXF 2.0.4 with
@SOAPBinding(style = SOAPBinding.Style.DOCUMENT,
            use = SOAPBinding.Use.LITERAL,
            parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)

I have following interface:

   boolean hasAccess(
           @WebParam(name = "application")
           final String applicationID,
           @WebParam(name = "id")
           final String userID,
           @WebParam(name = "item")
           final String itemID,
           @WebParam(name = "asset")
           final String assetID) ;

And there is generated following wsdl:

   <xs:element name="hasAccess" type="hasAccess"/>
   <xs:complexType name="hasAccess">
       <xs:sequence>
<xs:element minOccurs="0" name="application" type="xs:string"/>
           <xs:element minOccurs="0" name="id" type="xs:string"/>
           <xs:element minOccurs="0" name="item" type="xs:string"/>
           <xs:element minOccurs="0" name="asset" type="xs:string"/>
       </xs:sequence>
   </xs:complexType>

I think that one solution is to add @RequestWrapper, but it would require creating JavaBeans for all web service methods, what is not nice. Is there
any better solution?

Thanks,
Wojtek
--
View this message in context: 
http://www.nabble.com/Problem-with-minOccurs-tp18382936p18382936.html
Sent from the cxf-user mailing list archive at Nabble.com.


---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog




Reply via email to